From aec0f04f5da6786cdb12a5515c96af20c0478835 Mon Sep 17 00:00:00 2001 From: Lukasz Konopski Date: Mon, 21 Sep 2015 16:30:46 +0200 Subject: [PATCH 01/24] [#381] --auth fails on windows --- httpie/input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpie/input.py b/httpie/input.py index da3cc525..e57af359 100644 --- a/httpie/input.py +++ b/httpie/input.py @@ -521,7 +521,7 @@ class AuthCredentials(KeyValue): def _getpass(self, prompt): # To allow mocking. - return getpass.getpass(prompt) + return getpass.getpass(prompt.__str__()) def has_password(self): return self.value is not None From ed484c278bb4434fefe31d1f497f497e3c9567b6 Mon Sep 17 00:00:00 2001 From: honorabrutroll Date: Sun, 4 Oct 2015 17:06:00 -0500 Subject: [PATCH 02/24] Change pretty option processor to only raise error when using output file --- httpie/input.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httpie/input.py b/httpie/input.py index da3cc525..4d8af82e 100644 --- a/httpie/input.py +++ b/httpie/input.py @@ -378,7 +378,8 @@ class Parser(ArgumentParser): if self.args.prettify == PRETTY_STDOUT_TTY_ONLY: self.args.prettify = PRETTY_MAP[ 'all' if self.env.stdout_isatty else 'none'] - elif self.args.prettify and self.env.is_windows: + elif (self.args.prettify and self.env.is_windows and + self.args.output_file): self.error('Only terminal output can be colorized on Windows.') else: # noinspection PyTypeChecker From b1cc069fced514112e9ac9bd68400cbbdeb5e979 Mon Sep 17 00:00:00 2001 From: honorabrutroll Date: Sun, 4 Oct 2015 17:06:54 -0500 Subject: [PATCH 03/24] Add Edward Yang to AUTHORS.rst --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 1d7437d6..7fdf3045 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -33,3 +33,4 @@ Patches and ideas * `Matthias Lehmann `_ * `Dennis Brakhane `_ * `Matt Layman `_ +* `Edward Yang Date: Sun, 4 Oct 2015 17:16:41 -0500 Subject: [PATCH 04/24] Fixed AUTHORS.rst --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 7fdf3045..684fe8be 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -33,4 +33,4 @@ Patches and ideas * `Matthias Lehmann `_ * `Dennis Brakhane `_ * `Matt Layman `_ -* `Edward Yang `_ From 277da1ff9388053787e5948b71af0e94fa75d30b Mon Sep 17 00:00:00 2001 From: Lukasz Konopski Date: Wed, 21 Oct 2015 21:57:06 +0200 Subject: [PATCH 05/24] str conversion --- httpie/input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpie/input.py b/httpie/input.py index e57af359..1bc9acff 100644 --- a/httpie/input.py +++ b/httpie/input.py @@ -521,7 +521,7 @@ class AuthCredentials(KeyValue): def _getpass(self, prompt): # To allow mocking. - return getpass.getpass(prompt.__str__()) + return getpass.getpass(str(prompt)) def has_password(self): return self.value is not None From 45df86012480a1f73d909f8f49d177008a4d15dc Mon Sep 17 00:00:00 2001 From: Luis San Martin Date: Thu, 22 Oct 2015 14:32:16 -0300 Subject: [PATCH 06/24] PEP8 errors --- httpie/cli.py | 2 +- httpie/input.py | 6 +++--- httpie/utils.py | 1 - setup.py | 6 +++--- tests/fixtures.py | 1 - tests/test_auth.py | 1 - tests/test_docs.py | 6 +++--- tests/test_sessions.py | 19 ++++++++++++------- tests/test_uploads.py | 2 +- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/httpie/cli.py b/httpie/cli.py index 2b05a883..9a4d92ac 100644 --- a/httpie/cli.py +++ b/httpie/cli.py @@ -4,7 +4,7 @@ NOTE: the CLI interface may change before reaching v1.0. """ from textwrap import dedent, wrap -#noinspection PyCompatibility +# noinspection PyCompatibility from argparse import (RawDescriptionHelpFormatter, FileType, OPTIONAL, ZERO_OR_MORE, SUPPRESS) diff --git a/httpie/input.py b/httpie/input.py index da3cc525..f9e538ef 100644 --- a/httpie/input.py +++ b/httpie/input.py @@ -303,8 +303,8 @@ class Parser(ArgumentParser): # Infer the method has_data = ( (not self.args.ignore_stdin and not self.env.stdin_isatty) - or any(item.sep in SEP_GROUP_DATA_ITEMS - for item in self.args.items) + or any(item.sep in SEP_GROUP_DATA_ITEMS + for item in self.args.items) ) self.args.method = HTTP_POST if has_data else HTTP_GET @@ -572,7 +572,7 @@ class RequestItemsDict(OrderedDict): else: super(RequestItemsDict, self).__init__(*args, **kwargs) - #noinspection PyMethodOverriding + # noinspection PyMethodOverriding def __setitem__(self, key, value): """ If `key` is assigned more than once, `self[key]` holds a `list` of all the values. diff --git a/httpie/utils.py b/httpie/utils.py index ad2119aa..821fac9f 100644 --- a/httpie/utils.py +++ b/httpie/utils.py @@ -54,4 +54,3 @@ def humanize_bytes(n, precision=2): # noinspection PyUnboundLocalVariable return '%.*f %s' % (precision, n / factor, suffix) - diff --git a/setup.py b/setup.py index cab89c7c..fc19ccf3 100644 --- a/setup.py +++ b/setup.py @@ -40,12 +40,12 @@ install_requires = [ 'Pygments>=1.5' ] -### Conditional dependencies: +# Conditional dependencies: # sdist -if not 'bdist_wheel' in sys.argv: +if 'bdist_wheel' not in sys.argv: try: - #noinspection PyUnresolvedReferences + # noinspection PyUnresolvedReferences import argparse except ImportError: install_requires.append('argparse>=1.2.1') diff --git a/tests/fixtures.py b/tests/fixtures.py index c7b769e6..05737c71 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -38,4 +38,3 @@ with open(BIN_FILE_PATH, 'rb') as f: BIN_FILE_CONTENT = f.read() UNICODE = FILE_CONTENT - diff --git a/tests/test_auth.py b/tests/test_auth.py index 6d7cbb49..25006343 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -59,4 +59,3 @@ class TestAuth: assert args.auth assert args.auth.key == 'username' assert args.auth.value == '' - diff --git a/tests/test_docs.py b/tests/test_docs.py index ed2ad1e9..a02f6510 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -9,7 +9,7 @@ from utils import TESTS_ROOT def has_docutils(): try: - #noinspection PyUnresolvedReferences + # noinspection PyUnresolvedReferences import docutils return True except ImportError: @@ -32,8 +32,8 @@ assert filenames def test_rst_file_syntax(filename): p = subprocess.Popen( ['rst2pseudoxml.py', '--report=1', '--exit-status=1', filename], - stderr=subprocess.PIPE, - stdout=subprocess.PIPE + stderr=subprocess.PIPE, + stdout=subprocess.PIPE ) err = p.communicate()[1] assert p.returncode == 0, err diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 6a0d4b60..966d87b4 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -64,17 +64,20 @@ class TestSessionFlow(SessionTestBase): def test_session_update(self, httpbin): self.start_session(httpbin) # Get a response to a request from the original session. - r2 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r2 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r2 # Make a request modifying the session data. r3 = http('--follow', '--session=test', '--auth=username:password2', - 'GET', httpbin.url + '/cookies/set?hello=world2', 'Hello:World2', + 'GET', httpbin.url + '/cookies/set?hello=world2', + 'Hello:World2', env=self.env()) assert HTTP_OK in r3 # Get a response to a request from the updated session. - r4 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r4 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r4 assert r4.json['headers']['Hello'] == 'World2' assert r4.json['headers']['Cookie'] == 'hello=world2' @@ -84,7 +87,8 @@ class TestSessionFlow(SessionTestBase): def test_session_read_only(self, httpbin): self.start_session(httpbin) # Get a response from the original session. - r2 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r2 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r2 # Make a request modifying the session data but @@ -96,7 +100,8 @@ class TestSessionFlow(SessionTestBase): assert HTTP_OK in r3 # Get a response from the updated session. - r4 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r4 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r4 # Origin can differ on Travis. @@ -117,8 +122,8 @@ class TestSession(SessionTestBase): 'If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT', env=self.env()) assert HTTP_OK in r1 - - r2 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r2 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r2 assert no_content_type(r2.json['headers']) assert 'If-Unmodified-Since' not in r2.json['headers'] diff --git a/tests/test_uploads.py b/tests/test_uploads.py index e97bdafb..0bf8457e 100644 --- a/tests/test_uploads.py +++ b/tests/test_uploads.py @@ -30,7 +30,7 @@ class TestMultipartFormDataFileUpload: 'test-file@%s' % FILE_PATH_ARG) assert HTTP_OK in r assert r.count('Content-Disposition: form-data; name="test-file";' - ' filename="%s"' % os.path.basename(FILE_PATH)) == 2 + ' filename="%s"' % os.path.basename(FILE_PATH)) == 2 # Should be 4, but is 3 because httpbin # doesn't seem to support filed field lists assert r.count(FILE_CONTENT) in [3, 4] From 21ee981fc6bb61c95aa01345b2eefea15655bfdc Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 27 Nov 2015 15:02:23 +0100 Subject: [PATCH 07/24] Fix typo in CONTRIBUTING.rst --- CONTRIBUTING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b5052b31..01143337 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,7 +1,7 @@ Contributing to HTTPie ###################### -Bug reports and code and documentation patches are greatly appretiated. You can +Bug reports and code and documentation patches are greatly appreciated. You can also help by using the development version of HTTPie and reporting any bugs you might encounter. From fad84a962e3831c6a1f9b902e079d17192a75610 Mon Sep 17 00:00:00 2001 From: Alastair McGowan-Douglas Date: Tue, 15 Dec 2015 14:39:26 +0000 Subject: [PATCH 08/24] Aitch already has an official spelling - use it http://www.oxforddictionaries.com/definition/english/aitch --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 2c68568e..36a1a84d 100644 --- a/README.rst +++ b/README.rst @@ -2,9 +2,9 @@ HTTPie: a CLI, cURL-like tool for humans **************************************** -HTTPie (pronounced *aych-tee-tee-pie*) is a **command line HTTP client**. Its -goal is to make CLI interaction with web services as **human-friendly** as -possible. It provides a simple ``http`` command that allows for sending +HTTPie (pronounced *aitch-tee-tee-pie*) is a **command line HTTP client**. +Its goal is to make CLI interaction with web services as **human-friendly** +as possible. It provides a simple ``http`` command that allows for sending arbitrary HTTP requests using a simple and natural syntax, and displays colorized output. HTTPie can be used for **testing, debugging**, and generally **interacting** with HTTP servers. From cc0ba032908efeaefea47300cce0596f69229ab6 Mon Sep 17 00:00:00 2001 From: Tim Martin Date: Mon, 28 Dec 2015 10:28:04 -0600 Subject: [PATCH 09/24] Remove duplicate setup.py test option --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index cab89c7c..840517b2 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,6 @@ class PyTest(TestCommand): # and runs the tests with no fancy stuff like parallel execution. def finalize_options(self): TestCommand.finalize_options(self) - self.test_suite = True self.test_args = [ '--doctest-modules', '--verbose', './httpie', './tests' From 288cb4fdeb3823155ac084b9b988c82b2f1f81e3 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 18:26:42 -0300 Subject: [PATCH 10/24] Fix "mock requires setuptools>=17.1. Aborting installation" on Win+Py3 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 840517b2..2f77791c 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ class PyTest(TestCommand): tests_require = [ # Pytest needs to come last. # https://bitbucket.org/pypa/setuptools/issue/196/ + 'setuptools>=17.1', # Fix 'mock requires setuptools>=17.1' on Win+Py3 'pytest-httpbin', 'pytest', 'mock', From ab3d2656afaedc7b015daeba15a7775f5ba8481f Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 18:34:13 -0300 Subject: [PATCH 11/24] Undo 'Fix "mock requires setuptools>=17.1. Aborting installation" on Win+Py3' --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 7093dd55..9af19080 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,6 @@ class PyTest(TestCommand): tests_require = [ # Pytest needs to come last. # https://bitbucket.org/pypa/setuptools/issue/196/ - 'setuptools>=17.1', # Fix 'mock requires setuptools>=17.1' on Win+Py3 'pytest-httpbin', 'pytest', 'mock', From b034c8703abcde4a655474bba94799162957e822 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 18:41:58 -0300 Subject: [PATCH 12/24] PEP8 --- httpie/client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/httpie/client.py b/httpie/client.py index d55ce62c..1115f4dd 100644 --- a/httpie/client.py +++ b/httpie/client.py @@ -15,9 +15,10 @@ try: # https://urllib3.readthedocs.org/en/latest/security.html urllib3.disable_warnings() except AttributeError: - # In some rare cases, the user may have an old version of the requests or urllib3, - # and there is no method called "disable_warnings." In these cases, we don't need to call - # the method. They may get some noisy output but execution shouldn't die. Move on + # In some rare cases, the user may have an old version of the requests + # or urllib3, and there is no method called "disable_warnings." In these + # cases, we don't need to call the method. + # They may get some noisy output but execution shouldn't die. Move on. pass From 4e2b6b0cccbff2b7cbe61e26675cd6bd917bd936 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 18:46:01 -0300 Subject: [PATCH 13/24] Update get-pip.py URL --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1e73b258..25f499a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ init: - "ECHO %PYTHON%" - ps: "ls C:/Python*" install: - - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py') + - ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py') - "%PYTHON%/python.exe C:/get-pip.py" - "%PYTHON%/Scripts/pip.exe install -e ." test_script: From 33489c9a91bb3e9477a09d66ed2b72e177ed1070 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 18:51:17 -0300 Subject: [PATCH 14/24] Update pip on Appveyor --- appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 25f499a7..d5525006 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,8 +8,9 @@ init: - "ECHO %PYTHON%" - ps: "ls C:/Python*" install: - - ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py') - - "%PYTHON%/python.exe C:/get-pip.py" +# - ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py') +# - "%PYTHON%/python.exe C:/get-pip.py" + - "%PYTHON%/Scripts/pip.exe install -U pip" - "%PYTHON%/Scripts/pip.exe install -e ." test_script: - "%PYTHON%/Scripts/pip.exe --version" From c3e5456aba4f007cdcc404079b18b5c9722aaafd Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 19:01:39 -0300 Subject: [PATCH 15/24] Update setuptools on Appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d5525006..f7067b89 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ init: install: # - ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py') # - "%PYTHON%/python.exe C:/get-pip.py" - - "%PYTHON%/Scripts/pip.exe install -U pip" + - "%PYTHON%/Scripts/pip.exe install -U pip setuptools" - "%PYTHON%/Scripts/pip.exe install -e ." test_script: - "%PYTHON%/Scripts/pip.exe --version" From 4cadc1d4c0f2314a32e71a8df86a33c11162647b Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 19:08:27 -0300 Subject: [PATCH 16/24] Update pytest configuration * Move it from tox.ini to pytest.ini * Ignore tests/fixtures --- pytest.ini | 2 ++ tox.ini | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..a7785005 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +addopts = --tb=native +norecursedirs = tests/fixtures diff --git a/tox.ini b/tox.ini index 600ba3f1..6cab5b95 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,3 @@ deps = commands = py.test --verbose --doctest-modules --basetemp={envtmpdir} {posargs:./tests ./httpie} - -[pytest] -addopts = --tb=native From f14a0ad37d19fc2f93544f6d21592474d46b0520 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 19:11:22 -0300 Subject: [PATCH 17/24] Fix pytest configuration --- pytest.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/pytest.ini b/pytest.ini index a7785005..9735e581 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,3 @@ +[pytest] addopts = --tb=native norecursedirs = tests/fixtures From 47220763357f5a25cc535af5c4d2f4f092fb9abd Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 19:27:07 -0300 Subject: [PATCH 18/24] v0.9.3 --- CHANGELOG.rst | 11 ++++++++--- httpie/__init__.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 57309232..96e11258 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,12 +6,16 @@ This document records all notable changes to `HTTPie `_. This project adheres to `Semantic Versioning `_. -`1.0.0-dev`_ (Unreleased) +`0.9.3`_ (2016-01-01) ------------------------- * Changed the default color ``--style`` from ``solarized`` to ``monokai`` -* Added Bash auto complete support +* Added basic Bash autocomplete support (need to be installed manually) * Added request details to connection error messages +* Fixed ``'requests.packages.urllib3' has no attribute 'disable_warnings'`` + errors that occurred in some installations +* Fixed colors and formatting on Windows +* Fixed ``--auth`` prompt on Windows `0.9.2`_ (2015-02-24) @@ -252,4 +256,5 @@ This project adheres to `Semantic Versioning `_. .. _0.9.0: https://github.com/jkbrzt/httpie/compare/0.8.0...0.9.0 .. _0.9.1: https://github.com/jkbrzt/httpie/compare/0.9.0...0.9.1 .. _0.9.2: https://github.com/jkbrzt/httpie/compare/0.9.1...0.9.2 -.. _1.0.0-dev: https://github.com/jkbrzt/httpie/compare/0.9.2...master +.. _0.9.3: https://github.com/jkbrzt/httpie/compare/0.9.2...0.9.3 +.. _1.0.0-dev: https://github.com/jkbrzt/httpie/compare/0.9.3...master diff --git a/httpie/__init__.py b/httpie/__init__.py index 7ae07c9e..81e580ea 100644 --- a/httpie/__init__.py +++ b/httpie/__init__.py @@ -3,7 +3,7 @@ HTTPie - a CLI, cURL-like tool for humans. """ __author__ = 'Jakub Roztocil' -__version__ = '1.0.0-dev' +__version__ = '0.9.3' __licence__ = 'BSD' From 34c6958dc852106f82186a29dd8e045d2987783d Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Fri, 1 Jan 2016 19:38:21 -0300 Subject: [PATCH 19/24] 1.0.0-dev --- CHANGELOG.rst | 3 +++ httpie/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 96e11258..961f0375 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,9 @@ Change Log This document records all notable changes to `HTTPie `_. This project adheres to `Semantic Versioning `_. +`1.0.0-dev`_ (Unreleased) +------------------------- + `0.9.3`_ (2016-01-01) ------------------------- diff --git a/httpie/__init__.py b/httpie/__init__.py index 81e580ea..7ae07c9e 100644 --- a/httpie/__init__.py +++ b/httpie/__init__.py @@ -3,7 +3,7 @@ HTTPie - a CLI, cURL-like tool for humans. """ __author__ = 'Jakub Roztocil' -__version__ = '0.9.3' +__version__ = '1.0.0-dev' __licence__ = 'BSD' From 84b81c00eaf47d608aa59d919557622fdeb31978 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sat, 2 Jan 2016 14:07:00 -0300 Subject: [PATCH 20/24] Fixed tox.ini and improved tests and CONTRIBUTING.txt --- CONTRIBUTING.rst | 70 +++++++++++++++++++++++++++++------------------- Makefile | 8 +++++- httpie/config.py | 4 +-- tests/utils.py | 4 +-- tox.ini | 16 ++++++----- 5 files changed, 64 insertions(+), 38 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 01143337..3ffea063 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,12 +1,13 @@ +###################### Contributing to HTTPie ###################### -Bug reports and code and documentation patches are greatly appreciated. You can -also help by using the development version of HTTPie and reporting any bugs you -might encounter. +Bug reports and code and documentation patches are welcome. You can +help this project also by using the development version of HTTPie +and by reporting any bugs you might encounter. -Bug Reports -=========== +1. Reporting bugs +================= **It's important that you provide the full command argument list as well as the output of the failing command.** @@ -15,12 +16,12 @@ to your bug report, e.g.: .. code-block:: bash - $ http --debug [arguments that trigger the error] - [complete output] + $ http --debug [COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR] + [COMPLETE OUTPUT] -Contributing Code and Documentation -=================================== +2. Contributing Code and Docs +============================= Before working on a new feature or a bug, please browse `existing issues`_ to see whether it has been previously discussed. If the change in question @@ -28,8 +29,11 @@ is a bigger one, it's always good to discuss before your starting working on it. -Development Environment ------------------------ +Creating Development Environment +-------------------------------- + +Go to https://github.com/jkbrzt/httpie and fork the project repository. + .. code-block:: bash @@ -52,44 +56,56 @@ Making Changes Please make sure your changes conform to `Style Guide for Python Code`_ (PEP8). -Tests ------ +Testing +------- Before opening a pull requests, please make sure the `test suite`_ passes -in all of the `supported Python environments`_. You should also **add tests -for any new features and bug fixes**. +in all of the `supported Python environments`_. You should also add tests +for any new features and bug fixes. -HTTPie uses `pytest`_ and `Tox`_. +HTTPie uses `pytest`_ and `Tox`_ for testing. + + +Running all tests: +****************** .. code-block:: bash - ### Running all tests: - - # Current Python + # Run all tests on the current Python interpreter make test - # Current Python with coverage + # Run all tests on the current Python with coverage make test-cover - # All the supported and available Pythons via Tox + # Run all tests in all of the supported and available Pythons via Tox make test-tox - ### Running specific tests: - # Current Python - pytest tests/test_uploads.py +Running specific tests: +*********************** - # All Pythons +.. code-block:: bash + + # Run specific tests on the current Python + py.test tests/test_uploads.py + py.test tests/test_uploads.py::TestMultipartFormDataFileUpload + py.test tests/test_uploads.py::TestMultipartFormDataFileUpload::test_upload_ok + + # Run specific tests on the on all Pythons via Tox tox -- tests/test_uploads.py --verbose + tox -- tests/test_uploads.py::TestMultipartFormDataFileUpload --verbose + tox -- tests/test_uploads.py::TestMultipartFormDataFileUpload::test_upload_ok --verbose -Don't forget to add yourself to `AUTHORS.rst`_. +----- + +Don't forget to add yourself to `AUTHORS`_! .. _Tox: http://tox.testrun.org .. _supported Python environments: https://github.com/jkbrzt/httpie/blob/master/tox.ini .. _existing issues: https://github.com/jkbrzt/httpie/issues?state=open -.. _AUTHORS.rst: https://github.com/jkbrzt/httpie/blob/master/AUTHORS.rst +.. _AUTHORS: https://github.com/jkbrzt/httpie/blob/master/AUTHORS.rst .. _pytest: http://pytest.org/ .. _Style Guide for Python Code: http://python.org/dev/peps/pep-0008/ .. _test suite: https://github.com/jkbrzt/httpie/tree/master/tests diff --git a/Makefile b/Makefile index 26b65083..54f1ede6 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +# +# See ./CONTRIBUTING.rst +# + VERSION=$(shell grep __version__ httpie/__init__.py) REQUIREMENTS="requirements-dev.txt" TAG="\n\n\033[0;32m\#\#\# " @@ -7,6 +11,8 @@ all: test uninstall-httpie: @echo $(TAG)Removing existing installation of HTTPie$(END) + @echo "(NOTE: uninstall httpie manually if this fails)" + @echo - pip uninstall --yes httpie >/dev/null ! which http @echo @@ -22,7 +28,7 @@ init: uninstall-httpie @echo test: init - @echo $(TAG)Running tests in on current Python with coverage $(END) + @echo $(TAG)Running tests on the current Python interpreter with coverage $(END) py.test --cov ./httpie --cov ./tests --doctest-modules --verbose ./httpie ./tests @echo diff --git a/httpie/config.py b/httpie/config.py index 9f28da17..64f72b2b 100644 --- a/httpie/config.py +++ b/httpie/config.py @@ -6,11 +6,11 @@ from httpie import __version__ from httpie.compat import is_windows -DEFAULT_CONFIG_DIR = os.environ.get( +DEFAULT_CONFIG_DIR = str(os.environ.get( 'HTTPIE_CONFIG_DIR', os.path.expanduser('~/.httpie') if not is_windows else os.path.expandvars(r'%APPDATA%\\httpie') -) +)) class BaseConfigDict(dict): diff --git a/tests/utils.py b/tests/utils.py index aad27395..5efdd011 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -53,7 +53,7 @@ class TestEnvironment(Environment): stdout_isatty = True is_windows = False - _shutil = shutil # needed by __del__ (would get gc'd) + _shutil_rmtree = shutil.rmtree # needed by __del__ (would get gc'd) def __init__(self, **kwargs): @@ -72,7 +72,7 @@ class TestEnvironment(Environment): def __del__(self): if self.delete_config_dir: - self._shutil.rmtree(self.config_dir) + self._shutil_rmtree(self.config_dir) def http(*args, **kwargs): diff --git a/tox.ini b/tox.ini index 6cab5b95..f746660f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,22 @@ # Tox (http://tox.testrun.org/) is a tool for running tests -# in multiple virtualenvs. -# Run: -# $ pip install -r requirements-dev.txt -# $ tox +# in multiple virtualenvs. See ./CONTRIBUTING.rst [tox] -envlist = py26, py27, py34, pypy +envlist = py26, py27, py35, pypy [testenv] deps = + mock pytest pytest-httpbin>=0.0.6 + commands = - py.test --verbose --doctest-modules --basetemp={envtmpdir} {posargs:./tests ./httpie} + # NOTE: the order of the directories in posargs seems to matter. + # When changed, then many ImportMismatchError exceptions occurrs. + py.test \ + --verbose \ + --doctest-modules \ + {posargs:./httpie ./tests} From c82c9f0ae4317bcc2b9210b0fd61fb16d7a4041e Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sat, 2 Jan 2016 14:28:46 -0300 Subject: [PATCH 21/24] Makefile improvements --- CONTRIBUTING.rst | 5 +++++ Makefile | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 3ffea063..ca57350d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -80,6 +80,9 @@ Running all tests: # Run all tests in all of the supported and available Pythons via Tox make test-tox + # Run all tests for code as well as packaging, etc. + make test-all + Running specific tests: *********************** @@ -99,6 +102,7 @@ Running specific tests: ----- +See `Makefile`_ for additional development utilities. Don't forget to add yourself to `AUTHORS`_! @@ -106,6 +110,7 @@ Don't forget to add yourself to `AUTHORS`_! .. _supported Python environments: https://github.com/jkbrzt/httpie/blob/master/tox.ini .. _existing issues: https://github.com/jkbrzt/httpie/issues?state=open .. _AUTHORS: https://github.com/jkbrzt/httpie/blob/master/AUTHORS.rst +.. _Makefile: https://github.com/jkbrzt/httpie/blob/master/Makefile .. _pytest: http://pytest.org/ .. _Style Guide for Python Code: http://python.org/dev/peps/pep-0008/ .. _test suite: https://github.com/jkbrzt/httpie/tree/master/tests diff --git a/Makefile b/Makefile index 54f1ede6..ce47d6e5 100644 --- a/Makefile +++ b/Makefile @@ -10,14 +10,20 @@ END=" \#\#\# \033[0m\n" all: test uninstall-httpie: - @echo $(TAG)Removing existing installation of HTTPie$(END) - @echo "(NOTE: uninstall httpie manually if this fails)" + @echo $(TAG)Uninstalling httpie$(END) @echo - - pip uninstall --yes httpie >/dev/null - ! which http + - pip uninstall --yes httpie &2>/dev/null + @echo "Verifying…" + cd .. && ! python -m httpie --version &2>/dev/null + @echo "Done" @echo uninstall-all: uninstall-httpie + + @echo $(TAG)Uninstalling httpie requirements$(END) + - pip uninstall --yes pygments requests + + @echo $(TAG)Uninstalling development requirements$(END) - pip uninstall --yes -r $(REQUIREMENTS) init: uninstall-httpie From c6690e0182ac924e30a7c4800686f26a0aa7e5ad Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sat, 2 Jan 2016 14:33:48 -0300 Subject: [PATCH 22/24] Makefile improvements --- Makefile | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index ce47d6e5..89e0342e 100644 --- a/Makefile +++ b/Makefile @@ -7,45 +7,36 @@ REQUIREMENTS="requirements-dev.txt" TAG="\n\n\033[0;32m\#\#\# " END=" \#\#\# \033[0m\n" + all: test -uninstall-httpie: - @echo $(TAG)Uninstalling httpie$(END) - @echo - - pip uninstall --yes httpie &2>/dev/null - @echo "Verifying…" - cd .. && ! python -m httpie --version &2>/dev/null - @echo "Done" - @echo - -uninstall-all: uninstall-httpie - - @echo $(TAG)Uninstalling httpie requirements$(END) - - pip uninstall --yes pygments requests - - @echo $(TAG)Uninstalling development requirements$(END) - - pip uninstall --yes -r $(REQUIREMENTS) init: uninstall-httpie @echo $(TAG)Installing dev requirements$(END) pip install --upgrade -r $(REQUIREMENTS) + @echo $(TAG)Installing HTTPie$(END) pip install --upgrade --editable . + @echo + test: init @echo $(TAG)Running tests on the current Python interpreter with coverage $(END) py.test --cov ./httpie --cov ./tests --doctest-modules --verbose ./httpie ./tests @echo + test-tox: init @echo $(TAG)Running tests on all Pythons via Tox$(END) tox @echo + test-dist: test-sdist test-bdist-wheel @echo + test-sdist: clean uninstall-httpie @echo $(TAG)Testing sdist build an installation$(END) python setup.py sdist @@ -53,6 +44,7 @@ test-sdist: clean uninstall-httpie which http @echo + test-bdist-wheel: clean uninstall-httpie @echo $(TAG)Testing wheel build an installation$(END) python setup.py bdist_wheel @@ -60,9 +52,11 @@ test-bdist-wheel: clean uninstall-httpie which http @echo + # This tests everything, even this Makefile. test-all: uninstall-all clean init test test-tox test-dist + publish: test-all @echo $(TAG)Testing wheel build an installation$(END) @echo "$(VERSION)" @@ -72,8 +66,29 @@ publish: test-all python setup.py bdist_wheel upload @echo + clean: @echo $(TAG)Cleaning up$(END) rm -rf .tox *.egg dist build .coverage find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print @echo + + +uninstall-httpie: + @echo $(TAG)Uninstalling httpie$(END) + - pip uninstall --yes httpie &2>/dev/null + + @echo "Verifying…" + cd .. && ! python -m httpie --version &2>/dev/null + + @echo "Done" + @echo + + +uninstall-all: uninstall-httpie + + @echo $(TAG)Uninstalling httpie requirements$(END) + - pip uninstall --yes pygments requests + + @echo $(TAG)Uninstalling development requirements$(END) + - pip uninstall --yes -r $(REQUIREMENTS) From ea7654215088cc0cf09fa73bae04b3353f357437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Rozto=C4=8Dil?= Date: Fri, 15 Jan 2016 14:07:41 -0300 Subject: [PATCH 23/24] Added guardian/httpie-hmac-auth --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 36a1a84d..9e271d83 100644 --- a/README.rst +++ b/README.rst @@ -588,6 +588,7 @@ Auth Plugins ------------ * `httpie-oauth `_: OAuth +* `httpie-hmac-auth `_: HMAC * `httpie-ntlm `_: NTLM (NT LAN Manager) * `httpie-negotiate `_: SPNEGO (GSS Negotiate) * `requests-hawk `_: Hawk From a6a79e92e42cf09b1c873e78cf77ba6723f20d36 Mon Sep 17 00:00:00 2001 From: Prayag Verma Date: Mon, 18 Jan 2016 11:20:24 +0530 Subject: [PATCH 24/24] Update license year range to 2016 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index e3b1fc82..b84d413a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2012-2015 Jakub Roztocil +Copyright © 2012-2016 Jakub Roztocil Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: