diff --git a/.travis.yml b/.travis.yml index 513cf330..6826012b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ python: - 2.6 - 2.7 - pypy - - 3.1 - 3.2 script: python setup.py test install: diff --git a/README.rst b/README.rst index 11221a55..f50d5752 100644 --- a/README.rst +++ b/README.rst @@ -170,7 +170,7 @@ When using HTTPie from **shell scripts**, you might want to use the ``--check-status`` flag. It instructs HTTPie to exit with an error if the HTTP status is one of ``3xx``, ``4xx``, or ``5xx``. The exit status will be ``3`` (unless ``--allow-redirects`` is set), ``4``, or ``5`` -respectivelly:: +respectively:: #!/bin/bash @@ -191,7 +191,8 @@ Flags Most of the flags mirror the arguments understood by ``requests.request``. See ``http --help`` for more details:: - # http --help + + $ http --help usage: http [--help] [--version] [--json | --form] [--traceback] [--pretty | --ugly] [--print OUTPUT_OPTIONS | --verbose | --headers | --body] @@ -287,9 +288,8 @@ See ``http --help`` for more details:: --timeout TIMEOUT Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback). - Contribute ------------ +---------- `View contributors on GitHub `_. @@ -329,14 +329,14 @@ Changelog * `0.2.6dev `_ * Short option for ``--headers`` is now ``-h`` (``-t`` has been removed, for usage use ``--help``). - * Form data and URL params can now have mutiple fields with the same name + * Form data and URL params can now have multiple fields with the same name (e.g.,``http -f url a=1 a=2``). * Added ``--check-status`` to exit with an error for HTTP 3xx, 4xx and 5xx (3, 4, 5). * If the output is piped to another program or redirected to a file, the new default behaviour is to only print the response body. - (It can still be overriden via the ``--print`` flag.) - * Improved highlighing of HTTP headers. + (It can still be overwritten via the ``--print`` flag.) + * Improved highlighting of HTTP headers. * Added query string parameters (param==value). * Added support for terminal colors under Windows. * `0.2.5 `_ (2012-07-17) @@ -345,7 +345,7 @@ Changelog * --auth now prompts for a password if only a username provided. * Added support for request payloads from a file path with automatic ``Content-Type`` (``http URL @/path``). - * Fixed missing query string when displaing the request headers via + * Fixed missing query string when displaying the request headers via ``--verbose``. * Fixed Content-Type for requests with no data. * `0.2.2 `_ (2012-06-24) diff --git a/httpie/cliparse.py b/httpie/cliparse.py index a0c17bd1..32032d19 100644 --- a/httpie/cliparse.py +++ b/httpie/cliparse.py @@ -59,6 +59,7 @@ class Parser(argparse.ArgumentParser): action='help', default=argparse.SUPPRESS, help=argparse._('show this help message and exit')) + #noinspection PyMethodOverriding def parse_args(self, env, args=None, namespace=None): args = super(Parser, self).parse_args(args, namespace) @@ -324,6 +325,7 @@ class AuthCredentialsArgType(KeyValueArgType): class ParamDict(OrderedDict): + #noinspection PyMethodOverriding def __setitem__(self, key, value): """ If `key` is assigned more than once, `self[key]` holds a diff --git a/httpie/core.py b/httpie/core.py index fecce1b7..83ac94d1 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -1,7 +1,10 @@ import sys import json + import requests +import requests.auth from requests.compat import str + from .models import HTTPMessage, Environment from .output import OutputProcessor from . import cliparse @@ -12,7 +15,7 @@ TYPE_FORM = 'application/x-www-form-urlencoded; charset=utf-8' TYPE_JSON = 'application/json; charset=utf-8' -def get_response(args): +def get_response(args, env): auto_json = args.data and not args.form if args.json or auto_json: @@ -57,12 +60,12 @@ def get_response(args): ) except (KeyboardInterrupt, SystemExit): - sys.stderr.write('\n') + env.stderr.write('\n') sys.exit(1) except Exception as e: if args.traceback: raise - sys.stderr.write(str(e.message) + '\n') + env.stderr.write(str(e.message) + '\n') sys.exit(1) @@ -140,7 +143,7 @@ def main(args=sys.argv[1:], env=Environment()): """ args = cli.parser.parse_args(args=args, env=env) - response = get_response(args) + response = get_response(args, env) status = 0 diff --git a/httpie/models.py b/httpie/models.py index 51324818..d8e02e5f 100644 --- a/httpie/models.py +++ b/httpie/models.py @@ -76,6 +76,7 @@ class HTTPMessage(object): if request.params: if url.query: qs += '&' + #noinspection PyUnresolvedReferences qs += type(request)._encode_params(request.params) # Request-Line @@ -103,6 +104,7 @@ class HTTPMessage(object): # requests < 0.12.1 body = request._enc_data if isinstance(body, dict): + #noinspection PyUnresolvedReferences body = type(request)._encode_params(body) return HTTPMessage( diff --git a/httpie/output.py b/httpie/output.py index 226a3b0d..08827468 100644 --- a/httpie/output.py +++ b/httpie/output.py @@ -4,6 +4,7 @@ Colorizing of HTTP messages and content processing. """ import re import json + import pygments from pygments import token, lexer from pygments.styles import get_style_by_name, STYLE_MAP @@ -12,6 +13,7 @@ from pygments.formatters.terminal import TerminalFormatter from pygments.formatters.terminal256 import Terminal256Formatter from pygments.util import ClassNotFound from requests.compat import is_windows + from . import solarized diff --git a/setup.py b/setup.py index f56e6a61..cbfd801d 100644 --- a/setup.py +++ b/setup.py @@ -55,5 +55,6 @@ setup( 'Topic :: System :: Networking', 'Topic :: Terminals', 'Topic :: Text Processing', + 'Topic :: Utilities' ], ) diff --git a/tests/tests.py b/tests/tests.py index 0dbf31c5..029ed5cd 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -100,6 +100,7 @@ def http(*args, **kwargs): if TERMINAL_COLOR_PRESENCE_CHECK not in r: # De-serialize JSON body if possible. if r.strip().startswith('{'): + #noinspection PyTypeChecker r.json = json.loads(r) elif r.count('Content-Type:') == 1 and 'application/json' in r: try: @@ -886,4 +887,5 @@ class UnicodeOutputTestCase(BaseTestCase): if __name__ == '__main__': + #noinspection PyCallingNonCallable unittest.main() diff --git a/tox.ini b/tox.ini index fc337ed8..1a8912bd 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py26, py27, py30, py31, py32, pypy +envlist = py26, py27, py32, pypy [testenv] commands = {envpython} setup.py test