{ "info": { "author": "UNKNOWN", "author_email": "jakub@roztocil.co", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development", "Topic :: System :: Networking", "Topic :: Terminals", "Topic :: Text Processing", "Topic :: Utilities" ], "description": "HTTPie: a CLI, cURL-like tool for humans\n########################################\n\nHTTPie (pronounced *aitch-tee-tee-pie*) is a command line HTTP client.\nIts goal is to make CLI interaction with web services as human-friendly\nas possible. It provides a simple ``http`` command that allows for sending\narbitrary HTTP requests using a simple and natural syntax, and displays\ncolorized output. HTTPie can be used for testing, debugging, and\ngenerally interacting with HTTP servers.\n\n\n.. class:: no-web\n\n .. image:: https://raw.githubusercontent.com/jkbrzt/httpie/master/httpie.png\n :alt: HTTPie compared to cURL\n :width: 100%\n :align: center\n\n\n.. class:: no-web no-pdf\n\n|pypi| |unix_build| |windows_build| |coverage| |gitter|\n\n\n\n.. contents::\n\n.. section-numbering::\n\n\n\nMain features\n=============\n\n* Expressive and intuitive syntax\n* Formatted and colorized terminal output\n* Built-in JSON support\n* Forms and file uploads\n* HTTPS, proxies, and authentication\n* Arbitrary request data\n* Custom headers\n* Persistent sessions\n* Wget-like downloads\n* Python 2.6, 2.7 and 3.x support\n* Linux, Mac OS X and Windows support\n* Plugins\n* Documentation\n* Test coverage\n\n\nInstallation\n============\n\n\nmacOS\n-----\n\n\nOn macOS, HTTPie can be installed via `Homebrew `_\n(recommended):\n\n.. code-block:: bash\n\n $ brew install httpie\n\n\nA MacPorts *port* is also available:\n\n.. code-block:: bash\n\n $ port install httpie\n\nLinux\n-----\n\nMost Linux distributions provide a package that can be installed using the\nsystem package manager, e.g.:\n\n.. code-block:: bash\n\n # Debian-based distributions such as Ubuntu:\n $ apt-get install httpie\n\n # RPM-based distributions:\n $ yum install httpie\n\n # Arch Linux\n $ pacman -S httpie\n\n\nWindows, etc.\n-------------\n\nA universal installation method (that works on Windows, Mac OS X, Linux, \u2026,\nand always provides the latest version) is to use `pip`_:\n\n\n.. code-block:: bash\n\n # Make sure we have an up-to-date version of pip and setuptools:\n $ pip install --upgrade pip setuptools\n\n $ pip install --upgrade httpie\n\n\n(If ``pip`` installation fails for some reason, you can try\n``easy_install httpie`` as a fallback.)\n\n\nDevelopment version\n-------------------\n\nThe latest development version can be installed directly from GitHub:\n\n.. code-block:: bash\n\n # Mac OS X via Homebrew\n $ brew install httpie --HEAD\n\n # Universal\n $ pip install --upgrade https://github.com/jkbrzt/httpie/archive/master.tar.gz\n\n\nPython version\n--------------\n\nAlthough Python 2.6 and 2.7 are supported as well, it is recommended to install\nHTTPie against the latest Python 3.x whenever possible. That will ensure that\nsome of the newer HTTP features, such as `SNI (Server Name Indication)`_,\nwork out of the box.\nPython 3 is the default for Homebrew installations starting with version 0.9.4.\nTo see which version HTTPie uses, run ``http --debug``.\n\n\nUsage\n=====\n\n\nHello World:\n\n\n.. code-block:: bash\n\n $ http httpie.org\n\n\nSynopsis:\n\n.. code-block:: bash\n\n $ http [flags] [METHOD] URL [ITEM [ITEM]]\n\n\nSee also ``http --help``.\n\n\nExamples\n--------\n\nCustom `HTTP method`_, `HTTP headers`_ and `JSON`_ data:\n\n.. code-block:: bash\n\n $ http PUT example.org X-API-Token:123 name=John\n\n\nSubmitting `forms`_:\n\n.. code-block:: bash\n\n $ http -f POST example.org hello=World\n\n\nSee the request that is being sent using one of the `output options`_:\n\n.. code-block:: bash\n\n $ http -v example.org\n\n\nUse `Github API`_ to post a comment on an\n`issue `_\nwith `authentication`_:\n\n.. code-block:: bash\n\n $ http -a USERNAME POST https://api.github.com/repos/jkbrzt/httpie/issues/83/comments body='HTTPie is awesome! :heart:'\n\n\nUpload a file using `redirected input`_:\n\n.. code-block:: bash\n\n $ http example.org < file.json\n\n\nDownload a file and save it via `redirected output`_:\n\n.. code-block:: bash\n\n $ http example.org/file > file\n\n\nDownload a file ``wget`` style:\n\n.. code-block:: bash\n\n $ http --download example.org/file\n\nUse named `sessions`_ to make certain aspects or the communication persistent\nbetween requests to the same host:\n\n.. code-block:: bash\n\n $ http --session=logged-in -a username:password httpbin.org/get API-Key:123\n\n $ http --session=logged-in httpbin.org/headers\n\n\nSet a custom ``Host`` header to work around missing DNS records:\n\n.. code-block:: bash\n\n $ http localhost:8000 Host:example.com\n\n..\n\n\nHTTP method\n===========\n\nThe name of the HTTP method comes right before the URL argument:\n\n.. code-block:: bash\n\n $ http DELETE example.org/todos/7\n\n\nWhich looks similar to the actual ``Request-Line`` that is sent:\n\n.. code-block:: http\n\n DELETE /todos/7 HTTP/1.1\n\n\nWhen the ``METHOD`` argument is omitted from the command, HTTPie defaults to\neither ``GET`` (with no request data) or ``POST`` (with request data).\n\n\nRequest URL\n===========\n\nThe only information HTTPie needs to perform a request is a URL.\nThe default scheme is, somewhat unsurprisingly, ``http://``,\nand can be omitted from the argument \u2013 ``http example.org`` works just fine.\n\n\nQuerystring parameters\n----------------------\n\nIf you find yourself manually constructing URLs with\non the terminal, you may appreciate the ``param==value`` syntax for appending\nURL parameters. With that, you don't have to worry about escaping the ``&``\nseparators for your shell. Also, special characters in parameter values,\nwill also automatically escaped (HTTPie otherwise expects the URL to be\nalready escaped). To search for ``HTTPie logo`` on Google Images you could use\nthis command:\n\n.. code-block:: bash\n\n $ http www.google.com search=='HTTPie logo' tbm==isch\n\n\n.. code-block:: http\n\n GET /?search=HTTPie+logo&tbm=isch HTTP/1.1\n\n\n\nURL shortcuts for ``localhost``\n-------------------------------\n\nAdditionally, curl-like shorthand for localhost is supported.\nThis means that, for example ``:3000`` would expand to ``http://localhost:3000``\nIf the port is omitted, then port 80 is assumed.\n\n.. code-block:: bash\n\n $ http :/foo\n\n\n.. code-block:: http\n\n GET /foo HTTP/1.1\n Host: localhost\n\n\n.. code-block:: bash\n\n $ http :3000/bar\n\n\n.. code-block:: http\n\n GET /bar HTTP/1.1\n Host: localhost:3000\n\n\n.. code-block:: bash\n\n $ http :\n\n\n.. code-block:: http\n\n GET / HTTP/1.1\n Host: localhost\n\n\nCustom default scheme\n---------------------\n\nYou can use the ``--default-scheme `` option to create\nshortcuts for other protocols than HTTP:\n\n.. code-block:: bash\n\n $ alias https='http --default-scheme=https'\n\n\nRequest items\n=============\n\nThere are a few different *request item* types that provide a\nconvenient mechanism for specifying HTTP headers, simple JSON and\nform data, files, and URL parameters.\n\nThey are key/value pairs specified after the URL. All have in\ncommon that they become part of the actual request that is sent and that\ntheir type is distinguished only by the separator used:\n``:``, ``=``, ``:=``, ``==``, ``@``, ``=@``, and ``:=@``. The ones with an\n``@`` expect a file path as value.\n\n+-----------------------+-----------------------------------------------------+\n| Item Type | Description |\n+=======================+=====================================================+\n| HTTP Headers | Arbitrary HTTP header, e.g. ``X-API-Token:123``. |\n| ``Name:Value`` | |\n+-----------------------+-----------------------------------------------------+\n| URL parameters | Appends the given name/value pair as a query |\n| ``name==value`` | string parameter to the URL. |\n| | The ``==`` separator is used. |\n+-----------------------+-----------------------------------------------------+\n| Data Fields | Request data fields to be serialized as a JSON |\n| ``field=value``, | object (default), or to be form-encoded |\n| ``field=@file.txt`` | (``--form, -f``). |\n+-----------------------+-----------------------------------------------------+\n| Raw JSON fields | Useful when sending JSON and one or |\n| ``field:=json``, | more fields need to be a ``Boolean``, ``Number``, |\n| ``field:=@file.json`` | nested ``Object``, or an ``Array``, e.g., |\n| | ``meals:='[\"ham\",\"spam\"]'`` or ``pies:=[1,2,3]`` |\n| | (note the quotes). |\n+-----------------------+-----------------------------------------------------+\n| Form File Fields | Only available with ``--form, -f``. |\n| ``field@/dir/file`` | For example ``screenshot@~/Pictures/img.png``. |\n| | The presence of a file field results |\n| | in a ``multipart/form-data`` request. |\n+-----------------------+-----------------------------------------------------+\n\n\nNote that data fields aren't the only way to specify request data:\n`Redirected input`_ is a mechanism for passing arbitrary data request\nrequest.\n\n\nEscaping rules\n--------------\n\nYou can use ``\\`` to escape characters that shouldn't be used as separators\n(or parts thereof). For instance, ``foo\\==bar`` will become a data key/value\npair (``foo=`` and ``bar``) instead of a URL parameter.\n\nOften it is necessary to quote the values, e.g. ``foo='bar baz'``.\n\nIf any of the field names or headers starts with a minus\n(e.g., ``-fieldname``), you need to place all such items after the special\ntoken ``--`` to prevent confusion with ``--arguments``:\n\n.. code-block:: bash\n\n $ http httpbin.org/post -- -name-starting-with-dash=foo -Unusual-Header:bar\n\n.. code-block:: http\n\n POST /post HTTP/1.1\n -Unusual-Header: bar\n Content-Type: application/json\n\n {\n \"-name-starting-with-dash\": \"value\"\n }\n\n\n\nJSON\n====\n\nJSON is the *lingua franca* of modern web services and it is also the\n**implicit content type** HTTPie by default uses.\n\n\nSimple example:\n\n.. code-block:: bash\n\n $ http PUT example.org name=John email=john@example.org\n\n.. code-block:: http\n\n PUT / HTTP/1.1\n Accept: application/json, */*\n Accept-Encoding: gzip, deflate\n Content-Type: application/json\n Host: example.org\n\n {\n \"name\": \"John\",\n \"email\": \"john@example.org\"\n }\n\n\nDefault behaviour\n-----------------\n\n\nIf your command includes some data `request items`_, they are serialized as a JSON\nobject by default. HTTPie also automatically sets the following headers,\nboth of which can be overwritten:\n\n================ =======================================\n``Content-Type`` ``application/json``\n``Accept`` ``application/json, */*``\n================ =======================================\n\n\nExplicit JSON\n-------------\n\nYou can use ``--json, -j`` to explicitly set ``Accept``\nto ``application/json`` regardless of whether you are sending data\n(it's a shortcut for setting the header via the usual header notation:\n``http url Accept:'application/json, */*'``). Additionally,\nHTTPie will try to detect JSON responses even when the\n``Content-Type`` is incorrectly ``text/plain`` or unknown.\n\n\n\nNon-string JSON fields\n----------------------\n\nNon-string fields use the ``:=`` separator, which allows you to embed raw JSON\ninto the resulting object. Text and raw JSON files can also be embedded into\nfields using ``=@`` and ``:=@``:\n\n.. code-block:: bash\n\n $ http PUT api.example.com/person/1 \\\n name=John \\\n age:=29 married:=false hobbies:='[\"http\", \"pies\"]' \\ # Raw JSON\n description=@about-john.txt \\ # Embed text file\n bookmarks:=@bookmarks.json # Embed JSON file\n\n\n.. code-block:: http\n\n PUT /person/1 HTTP/1.1\n Accept: application/json, */*\n Content-Type: application/json\n Host: api.example.com\n\n {\n \"age\": 29,\n \"hobbies\": [\n \"http\",\n \"pies\"\n ],\n \"description\": \"John is a nice guy who likes pies.\",\n \"married\": false,\n \"name\": \"John\",\n \"bookmarks\": {\n \"HTTPie\": \"http://httpie.org\",\n }\n }\n\n\nPlease note that with this syntax the command gets unwieldy when sending\ncomplex data. In that case it's always better to use `redirected input`_:\n\n.. code-block:: bash\n\n $ http POST api.example.com/person/1 < person.json\n\n\nForms\n=====\n\nSubmitting forms is very similar to sending `JSON`_ requests. Often the only\ndifference is in adding the ``--form, -f`` option, which ensures that\ndata fields are serialized as, and ``Content-Type`` is set to,\n``application/x-www-form-urlencoded; charset=utf-8``. It is possible to make\nform data the implicit content type instead of JSON\nvia the `config`_ file.\n\n\nRegular forms\n-------------\n\n.. code-block:: bash\n\n $ http --form POST api.example.org/person/1 name='John Smith'\n\n\n.. code-block:: http\n\n POST /person/1 HTTP/1.1\n Content-Type: application/x-www-form-urlencoded; charset=utf-8\n\n name=John+Smith\n\n\nFile upload forms\n-----------------\n\nIf one or more file fields is present, the serialization and content type is\n``multipart/form-data``:\n\n.. code-block:: bash\n\n $ http -f POST example.com/jobs name='John Smith' cv@~/Documents/cv.pdf\n\n\nThe request above is the same as if the following HTML form were\nsubmitted:\n\n.. code-block:: html\n\n
\n \n \n
\n\nNote that ``@`` is used to simulate a file upload form field, whereas\n``=@`` just embeds the file content as a regular text field value.\n\n\nHTTP headers\n============\n\nTo set custom headers you can use the ``Header:Value`` notation:\n\n.. code-block:: bash\n\n $ http example.org User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' \\\n X-Foo:Bar Referer:http://httpie.org/\n\n\n.. code-block:: http\n\n GET / HTTP/1.1\n Accept: */*\n Accept-Encoding: gzip, deflate\n Cookie: valued-visitor=yes;foo=bar\n Host: example.org\n Referer: http://httpie.org/\n User-Agent: Bacon/1.0\n X-Foo: Bar\n\n\nDefault request headers\n-----------------------\n\nThere are a couple of default headers that HTTPie sets:\n\n.. code-block:: http\n\n GET / HTTP/1.1\n Accept: */*\n Accept-Encoding: gzip, deflate\n User-Agent: HTTPie/\n Host: \n\n\n\nAny of those\u2014except for ``Host``\u2014can be overwritten and some of them unset.\n\n\n\nEmpty headers and header un-setting\n-----------------------------------\n\nTo unset a previously specified header\n(such a one of the default headers), use ``Header:``:\n\n\n.. code-block:: bash\n\n $ http httpbin.org/headers Accept: User-Agent:\n\n\nTo send a header with an empty value, use ``Header;``:\n\n\n.. code-block:: bash\n\n $ http httpbin.org/headers 'Header;'\n\n\nAuthentication\n==============\n\nThe currently supported authentication schemes are Basic and Digest\n(see `auth plugins`_ for more). There are two flags that control authentication:\n\n=================== ======================================================\n``--auth, -a`` Pass a ``username:password`` pair as\n the argument. Or, if you only specify a username\n (``-a username``), you'll be prompted for\n the password before the request is sent.\n To send an empty password, pass ``username:``.\n The ``username:password@hostname`` URL syntax is\n supported as well (but credentials passed via ``-a``\n have higher priority).\n\n``--auth-type, -A`` Specify the auth mechanism. Possible values are\n ``basic`` and ``digest``. The default value is\n ``basic`` so it can often be omitted.\n=================== ======================================================\n\n\n\nBasic auth\n----------\n\n\n.. code-block:: bash\n\n $ http -a username:password example.org\n\n\nDigest auth\n-----------\n\n\n.. code-block:: bash\n\n $ http -A digest -a username:password example.org\n\n\nPassword prompt\n---------------\n\n.. code-block:: bash\n\n $ http -a username example.org\n\n\n``.netrc``\n----------\n\nAuthorization information from your ``~/.netrc`` file is honored as well:\n\n.. code-block:: bash\n\n $ cat ~/.netrc\n machine httpbin.org\n login httpie\n password test\n\n $ http httpbin.org/basic-auth/httpie/test\n HTTP/1.1 200 OK\n [...]\n\n\nAuth plugins\n------------\n\nAdditional authentication mechanism can be installed as plugins.\nThey can be found on the `Python Package Index `_.\nHere's a few picks:\n\n* `httpie-api-auth `_: ApiAuth\n* `httpie-aws-auth `_: AWS / Amazon S3\n* `httpie-edgegrid `_: EdgeGrid\n* `httpie-hmac-auth `_: HMAC\n* `httpie-jwt-auth `_: JWTAuth (JSON Web Tokens)\n* `httpie-negotiate `_: SPNEGO (GSS Negotiate)\n* `httpie-ntlm `_: NTLM (NT LAN Manager)\n* `httpie-oauth `_: OAuth\n* `requests-hawk `_: Hawk\n\n\n\n\nHTTP redirects\n==============\n\nBy default, HTTP redirects are not followed and only the first\nresponse is shown:\n\n\n.. code-block:: bash\n\n $ http httpbin.org/redirect/3\n\n\nFollow ``Location``\n-------------------\n\nTo instruct HTTPie to follow the ``Location`` header of ``30x`` responses\nand show the final response instead, use the ``--follow, -F`` option:\n\n\n.. code-block:: bash\n\n $ http --follow httpbin.org/redirect/3\n\n\nShowing intermediary redirect responses\n---------------------------------------\n\nIf you additionally wish to see the intermediary requests/responses,\nthen use the ``--all`` option as well:\n\n\n.. code-block:: bash\n\n $ http --follow --all httpbin.org/redirect/3\n\n\n\nLimiting maximum redirects followed\n-----------------------------------\n\nTo change the default limit of maximum ``30`` redirects, use the\n``--max-redirects=`` option:\n\n\n.. code-block:: bash\n\n $ http --follow --all --max-redirects=5 httpbin.org/redirect/3\n\n\nProxies\n=======\n\nYou can specify proxies to be used through the ``--proxy`` argument for each\nprotocol (which is included in the value in case of redirects across protocols):\n\n.. code-block:: bash\n\n $ http --proxy=http:http://10.10.1.10:3128 --proxy=https:https://10.10.1.10:1080 example.org\n\n\nWith Basic authentication:\n\n.. code-block:: bash\n\n $ http --proxy=http:http://user:pass@10.10.1.10:3128 example.org\n\n\nEnvironment variables\n---------------------\n\nYou can also configure proxies by environment variables ``HTTP_PROXY`` and\n``HTTPS_PROXY``, and the underlying Requests library will pick them up as well.\nIf you want to disable proxies configured through the environment variables for\ncertain hosts, you can specify them in ``NO_PROXY``.\n\nIn your ``~/.bash_profile``:\n\n.. code-block:: bash\n\n export HTTP_PROXY=http://10.10.1.10:3128\n export HTTPS_PROXY=https://10.10.1.10:1080\n export NO_PROXY=localhost,example.com\n\n\nSOCKS\n-----\n\nTo enable SOCKS proxy support please install ``requests[socks]`` using ``pip``:\n\n\n.. code-block:: bash\n\n $ pip install -U requests[socks]\n\nUsage is the same as for other types of `proxies`_:\n\n.. code-block:: bash\n\n $ http --proxy=http:socks5://user:pass@host:port --proxy=https:socks5://user:pass@host:port example.org\n\n\nHTTPS\n=====\n\n\nServer SSL certificate verification\n-----------------------------------\n\nTo skip the host's SSL certificate verification, you can pass ``--verify=no``\n(default is ``yes``):\n\n.. code-block:: bash\n\n $ http --verify=no https://example.org\n\n\nCustom CA bundle\n----------------\n\nYou can also use ``--verify=`` to set a custom CA bundle path:\n\n.. code-block:: bash\n\n $ http --verify=/ssl/custom_ca_bundle https://example.org\n\n\n\nClient side SSL certificate\n---------------------------\nTo use a client side certificate for the SSL communication, you can pass\nthe path of the cert file with ``--cert``:\n\n.. code-block:: bash\n\n $ http --cert=client.pem https://example.org\n\n\nIf the private key is not contained in the cert file you may pass the\npath of the key file with ``--cert-key``:\n\n.. code-block:: bash\n\n $ http --cert=client.crt --cert-key=client.key https://example.org\n\n\nSSL version\n-----------\n\nUse the ``--ssl=`` to specify the desired protocol version to use.\nThis will default to SSL v2.3 which will negotiate the highest protocol that both\nthe server and your installation of OpenSSL support. The available protocols\nare ``ssl2.3``, ``ssl3``, ``tls1``, ``tls1.1``, ``tls1.2``. (The actually\navailable set of protocols may vary depending on your OpenSSL installation.)\n\n.. code-block:: bash\n\n # Specify the vulnerable SSL v3 protocol to talk to an outdated server:\n $ http --ssl=ssl3 https://vulnerable.example.org\n\n\nSNI (Server Name Indication)\n----------------------------\n\nIf you use HTTPie with `Python version`_ lower than 2.7.9\n(can be verified with ``http --debug``) and need to talk to servers that\nuse SNI (Server Name Indication) you need to install some additional\ndependencies:\n\n.. code-block:: bash\n\n $ pip install --upgrade requests[security]\n\n\nYou can use the following command to test SNI support:\n\n.. code-block:: bash\n\n $ http https://sni.velox.ch\n\n\nOutput options\n==============\n\nBy default, HTTPie only outputs the final response and the whole response\nmessage is printed (headers as well as the body). You can control what should\nbe printed via several options:\n\n================= =====================================================\n``--headers, -h`` Only the response headers are printed.\n``--body, -b`` Only the response body is printed.\n``--verbose, -v`` Print the whole HTTP exchange (request and response).\n This option also enables ``--all`` (see bellow).\n``--print, -p`` Selects parts of the HTTP exchange.\n================= =====================================================\n\n``--verbose`` can often be useful for debugging the request and generating\ndocumentation examples:\n\n.. code-block:: bash\n\n $ http --verbose PUT httpbin.org/put hello=world\n PUT /put HTTP/1.1\n Accept: application/json, */*\n Accept-Encoding: gzip, deflate\n Content-Type: application/json\n Host: httpbin.org\n User-Agent: HTTPie/0.2.7dev\n\n {\n \"hello\": \"world\"\n }\n\n\n HTTP/1.1 200 OK\n Connection: keep-alive\n Content-Length: 477\n Content-Type: application/json\n Date: Sun, 05 Aug 2012 00:25:23 GMT\n Server: gunicorn/0.13.4\n\n {\n [\u2026]\n }\n\n\nWhat parts of the HTTP exchange should be printed\n-------------------------------------------------\n\nAll the other `output options`_ are under the hood just shortcuts for\nthe more powerful ``--print, -p``. It accepts a string of characters each\nof which represents a specific part of the HTTP exchange:\n\n========== ==================\nCharacter Stands for\n========== ==================\n``H`` request headers\n``B`` request body\n``h`` response headers\n``b`` response body\n========== ==================\n\nPrint request and response headers:\n\n.. code-block:: bash\n\n $ http --print=Hh PUT httpbin.org/put hello=world\n\n\nViewing intermediary requests/responses\n---------------------------------------\n\nTo see all the HTTP communication, i.e. the final request/response as\nwell as any possible intermediary requests/responses, use the ``--all``\noption. The intermediary HTTP communication include followed redirects\n(with ``--follow``), the first unauthorized request when HTTP digest\nauthentication is used (``--auth=digest``), etc.\n\n.. code-block:: bash\n\n # Include all responses that lead to the final one:\n $ http --all --follow httpbin.org/redirect/3\n\n\nThe intermediary requests/response are by default formatted according to\n``--print, -p`` (and its shortcuts described above). If you'd like to change\nthat, use the ``--history-print, -P`` option. It takes the same\narguments as ``--print, -p`` but applies to the intermediary requests only.\n\n\n.. code-block:: bash\n\n # Print the intermediary requests/responses differently than the final one:\n $ http -A digest -a foo:bar --all -p Hh -P H httpbin.org/digest-auth/auth/foo/bar\n\n\nConditional body download\n-------------------------\n\nAs an optimization, the response body is downloaded from the server\nonly if it's part of the output. This is similar to performing a ``HEAD``\nrequest, except that it applies to any HTTP method you use.\n\nLet's say that there is an API that returns the whole resource when it is\nupdated, but you are only interested in the response headers to see the\nstatus code after an update:\n\n.. code-block:: bash\n\n $ http --headers PATCH example.org/Really-Huge-Resource name='New Name'\n\n\nSince we are only printing the HTTP headers here, the connection to the server\nis closed as soon as all the response headers have been received.\nTherefore, bandwidth and time isn't wasted downloading the body\nwhich you don't care about. The response headers are downloaded always,\neven if they are not part of the output\n\n\nRedirected Input\n================\n\nThe universal method for passing request data is through redirected ``stdin``\n(standard input)\u2014piping. Such data is buffered and then with no further\nprocessing used as the request body. There are multiple useful ways to use\npiping:\n\nRedirect from a file:\n\n.. code-block:: bash\n\n $ http PUT example.com/person/1 X-API-Token:123 < person.json\n\n\nOr the output of another program:\n\n.. code-block:: bash\n\n $ grep '401 Unauthorized' /var/log/httpd/error_log | http POST example.org/intruders\n\n\nYou can use ``echo`` for simple data:\n\n.. code-block:: bash\n\n $ echo '{\"name\": \"John\"}' | http PATCH example.com/person/1 X-API-Token:123\n\n\nYou can even pipe web services together using HTTPie:\n\n.. code-block:: bash\n\n $ http GET https://api.github.com/repos/jkbrzt/httpie | http POST httpbin.org/post\n\n\nYou can use ``cat`` to enter multiline data on the terminal:\n\n.. code-block:: bash\n\n $ cat | http POST example.com\n \n ^D\n\n\n.. code-block:: bash\n\n $ cat | http POST example.com/todos Content-Type:text/plain\n - buy milk\n - call parents\n ^D\n\n\nOn OS X, you can send the contents of the clipboard with ``pbpaste``:\n\n.. code-block:: bash\n\n $ pbpaste | http PUT example.com\n\n\nPassing data through ``stdin`` cannot be combined with data fields specified\non the command line:\n\n\n.. code-block:: bash\n\n $ echo 'data' | http POST example.org more=data # This is invalid\n\n\nTo prevent HTTPie from reading ``stdin`` data you can use the\n``--ignore-stdin`` option.\n\n\nRequest data from a filename\n----------------------------\n\nAn alternative to redirected ``stdin`` is specifying a filename (as\n``@/path/to/file``) whose content is used as if it came from ``stdin``.\n\nIt has the advantage that the ``Content-Type``\nheader is automatically set to the appropriate value based on the\nfilename extension. For example, the following request sends the\nverbatim contents of that XML file with ``Content-Type: application/xml``:\n\n.. code-block:: bash\n\n $ http PUT httpbin.org/put @/data/file.xml\n\n\nTerminal output\n===============\n\nHTTPie does several things by default in order to make its terminal output\neasy to read.\n\n\nColors and formatting\n---------------------\n\nSyntax highlighting is applied to HTTP headers and bodies (where it makes\nsense). You can choose your preferred color scheme via the ``--style`` option\nif you don't like the default one (see ``$ http --help`` for the possible\nvalues).\n\nAlso, the following formatting is applied:\n\n* HTTP headers are sorted by name.\n* JSON data is indented, sorted by keys, and unicode escapes are converted\n to the characters they represent.\n\nOne of these options can be used to control output processing:\n\n==================== ========================================================\n``--pretty=all`` Apply both colors and formatting.\n Default for terminal output.\n``--pretty=colors`` Apply colors.\n``--pretty=format`` Apply formatting.\n``--pretty=none`` Disables output processing.\n Default for redirected output.\n==================== ========================================================\n\nBinary data\n-----------\n\nBinary data is suppressed for terminal output, which makes it safe to perform\nrequests to URLs that send back binary data. Binary data is suppressed also in\nredirected, but prettified output. The connection is closed as soon as we know\nthat the response body is binary,\n\n.. code-block:: bash\n\n $ http example.org/Movie.mov\n\n\nYou will nearly instantly see something like this:\n\n.. code-block:: http\n\n HTTP/1.1 200 OK\n Accept-Ranges: bytes\n Content-Encoding: gzip\n Content-Type: video/quicktime\n Transfer-Encoding: chunked\n\n +-----------------------------------------+\n | NOTE: binary data not shown in terminal |\n +-----------------------------------------+\n\n\nRedirected output\n=================\n\nHTTPie uses a different set of defaults for redirected output than for\n`terminal output`_. The differences being:\n\n* Formatting and colors aren't applied (unless ``--pretty`` is specified).\n* Only the response body is printed (unless one of the `output options`_ is set).\n* Also, binary data isn't suppressed.\n\nThe reason is to make piping HTTPie's output to another programs and\ndownloading files work with no extra flags. Most of the time, only the raw\nresponse body is of an interest when the output is redirected.\n\nDownload a file:\n\n.. code-block:: bash\n\n $ http example.org/Movie.mov > Movie.mov\n\n\nDownload an image of Octocat, resize it using ImageMagick, upload it elsewhere:\n\n.. code-block:: bash\n\n $ http octodex.github.com/images/original.jpg | convert - -resize 25% - | http example.org/Octocats\n\n\nForce colorizing and formatting, and show both the request and the response in\n``less`` pager:\n\n.. code-block:: bash\n\n $ http --pretty=all --verbose example.org | less -R\n\n\nThe ``-R`` flag tells ``less`` to interpret color escape sequences included\nHTTPie`s output.\n\nYou can create a shortcut for invoking HTTPie with colorized and paged output\nby adding the following to your ``~/.bash_profile``:\n\n.. code-block:: bash\n\n function httpless {\n # `httpless example.org'\n http --pretty=all --print=hb \"$@\" | less -R;\n }\n\n\nDownload mode\n=============\n\nHTTPie features a download mode in which it acts similarly to ``wget``.\n\nWhen enabled using the ``--download, -d`` flag, response headers are printed to\nthe terminal (``stderr``), and a progress bar is shown while the response body\nis being saved to a file.\n\n.. code-block:: bash\n\n $ http --download https://github.com/jkbrzt/httpie/archive/master.tar.gz\n\n.. code-block:: http\n\n HTTP/1.1 200 OK\n Content-Disposition: attachment; filename=httpie-master.tar.gz\n Content-Length: 257336\n Content-Type: application/x-gzip\n\n Downloading 251.30 kB to \"httpie-master.tar.gz\"\n Done. 251.30 kB in 2.73862s (91.76 kB/s)\n\n\nDownloaded file name\n--------------------\n\nIf not provided via ``--output, -o``, the output filename will be determined\nfrom ``Content-Disposition`` (if available), or from the URL and\n``Content-Type``. If the guessed filename already exists, HTTPie adds a unique\nsuffix to it.\n\n\nPiping while downloading\n------------------------\n\nYou can also redirect the response body to another program while the response\nheaders and progress are still shown in the terminal:\n\n.. code-block:: bash\n\n $ http -d https://github.com/jkbrzt/httpie/archive/master.tar.gz | tar zxf -\n\n\n\nResuming downloads\n------------------\n\nIf ``--output, -o`` is specified, you can resume a partial download using the\n``--continue, -c`` option. This only works with servers that support\n``Range`` requests and ``206 Partial Content`` responses. If the server doesn't\nsupport that, the whole file will simply be downloaded:\n\n.. code-block:: bash\n\n $ http -dco file.zip example.org/file\n\nOther notes\n-----------\n\n* The ``--download`` option only changes how the response body is treated.\n* You can still set custom headers, use sessions, ``--verbose, -v``, etc.\n* ``--download`` always implies ``--follow`` (redirects are followed).\n* HTTPie exits with status code ``1`` (error) if the body hasn't been fully\n downloaded.\n* ``Accept-Encoding`` cannot be set with ``--download``.\n\n\nStreamed responses\n==================\n\nResponses are downloaded and printed in chunks which allows for streaming\nand large file downloads without using too much memory. However, when\n`colors and formatting`_ is applied, the whole response is buffered and only\nthen processed at once.\n\n\nDisabling buffering\n-------------------\n\nYou can use the ``--stream, -S`` flag to make two things happen:\n\n1. The output is flushed in much smaller chunks without any buffering,\n which makes HTTPie behave kind of like ``tail -f`` for URLs.\n\n2. Streaming becomes enabled even when the output is prettified: It will be\n applied to each line of the response and flushed immediately. This makes\n it possible to have a nice output for long-lived requests, such as one\n to the Twitter streaming API.\n\n\nExamples use cases\n------------------\n\nPrettified streamed response:\n\n.. code-block:: bash\n\n $ http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track='Justin Bieber'\n\n\nStreamed output by small chunks al\u00e1 ``tail -f``:\n\n.. code-block:: bash\n\n # Send each new tweet (JSON object) mentioning \"Apple\" to another\n # server as soon as it arrives from the Twitter streaming API:\n $ http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track=Apple \\\n | while read tweet; do echo \"$tweet\" | http POST example.org/tweets ; done\n\nSessions\n========\n\nBy default, every request HTTPie makes is completely independent of any\nprevious ones to the same host.\n\n\nHowever, HTTPie also supports persistent\nsessions via the ``--session=SESSION_NAME_OR_PATH`` option. In a session,\ncustom headers\u2014except for the ones starting with ``Content-`` or ``If-``\u2014,\nauthorization, and cookies\n(manually specified or sent by the server) persist between requests\nto the same host.\n\n\n.. code-block:: bash\n\n # Create a new session\n $ http --session=/tmp/session.json example.org API-Token:123\n\n # Re-use an existing session \u2014 API-Token will be set:\n $ http --session=/tmp/session.json example.org\n\n\n\nAll session data, including credentials, cookie data,\nand custom headers are stored in plain text.\nThat means session files can also be created and edited manually in a text\neditor\u2014they are regular JSON.\n\nNamed sessions\n--------------\n\n\nYou can create one or more named session per host. For example, this is how\nyou can create a new session named ``user1`` for ``example.org``:\n\n.. code-block:: bash\n\n $ http --session=user1 -a user1:password example.org X-Foo:Bar\n\nFrom now onw, you can refer to the session by its name. When you choose to\nuse the session again, any the previously used authorization and HTTP headers\nwill automatically be set:\n\n.. code-block:: bash\n\n $ http --session=user1 example.org\n\nTo create or reuse a different session, simple specify a different name:\n\n.. code-block:: bash\n\n $ http --session=user2 -a user2:password example.org X-Bar:Foo\n\nNamed sessions' data is stored in JSON files in the directory\n``~/.httpie/sessions//.json``\n(``%APPDATA%\\httpie\\sessions\\\\.json`` on Windows).\n\n\nAnonymous sessions\n------------------\n\nInstead of a name, you can also directly specify a path to a session file. This\nallows for sessions to be re-used across multiple hosts:\n\n.. code-block:: bash\n\n $ http --session=/tmp/session.json example.org\n $ http --session=/tmp/session.json admin.example.org\n $ http --session=~/.httpie/sessions/another.example.org/test.json example.org\n $ http --session-read-only=/tmp/session.json example.org\n\n\nReadonly session\n----------------\n\nTo use an existing session file without updating it from the request/response\nexchange once it is created, specify the session name via\n``--session-read-only=SESSION_NAME_OR_PATH`` instead.\n\n\nConfig\n======\n\nHTTPie uses a simple JSON config file.\n\n\n\nConfig file location\n--------------------\n\n\nThe default location of the configuration file is ``~/.httpie/config.json``\n(or ``%APPDATA%\\httpie\\config.json`` on Windows). The config directory\nlocation can be changed by setting the ``HTTPIE_CONFIG_DIR``\nenvironment variable. To view the exact location run ``http --debug``.\n\nConfigurable options\n--------------------\n\nThe JSON file contains an object with the following keys:\n\n\n``default_options``\n~~~~~~~~~~~~~~~~~~~\n\n\nAn ``Array`` (by default empty) of default options that should be applied to\nevery invocation of HTTPie.\n\nFor instance, you can use this option to change the default style and output\noptions: ``\"default_options\": [\"--style=fruity\", \"--body\"]`` Another useful\ndefault option could be ``\"--session=default\"`` to make HTTPie always\nuse `sessions`_ (one named ``default`` will automatically be used).\nOr you could change the implicit request content type from JSON to form by\nadding ``--form`` to the list.\n\n\n``__meta__``\n~~~~~~~~~~~~\n\nHTTPie automatically stores some of its metadata here. Please do not change.\n\n\n\nUn-setting previously specified options\n---------------------------------------\n\nDefault options from the config file, or specified any other way,\ncan be unset for a particular invocation via ``--no-OPTION`` arguments passed\non the command line (e.g., ``--no-style`` or ``--no-session``).\n\n\n\nScripting\n=========\n\nWhen using HTTPie from shell scripts, it can be handy to set the\n``--check-status`` flag. It instructs HTTPie to exit with an error if the\nHTTP status is one of ``3xx``, ``4xx``, or ``5xx``. The exit status will\nbe ``3`` (unless ``--follow`` is set), ``4``, or ``5``,\nrespectively.\n\n.. code-block:: bash\n\n #!/bin/bash\n\n if http --check-status --ignore-stdin --timeout=2.5 HEAD example.org/health &> /dev/null; then\n echo 'OK!'\n else\n case $? in\n 2) echo 'Request timed out!' ;;\n 3) echo 'Unexpected HTTP 3xx Redirection!' ;;\n 4) echo 'HTTP 4xx Client Error!' ;;\n 5) echo 'HTTP 5xx Server Error!' ;;\n 6) echo 'Exceeded --max-redirects= redirects!' ;;\n *) echo 'Other Error!' ;;\n esac\n fi\n\n\nBest practices\n--------------\n\nThe default behaviour of automatically reading ``stdin`` is typically not\ndesirable during non-interactive invocations. You most likely want\nuse the ``--ignore-stdin`` option to disable it.\n\nIt is a common gotcha that without this option HTTPie seemingly hangs.\nWhat happens is that when HTTPie is invoked for example from a cron job,\n``stdin`` is not connected to a terminal.\nTherefore, rules for `redirected input`_ apply, i.e., HTTPie starts to read it\nexpecting that the request body will be passed through.\nAnd since there's no data nor ``EOF``, it will be stuck. So unless you're\npiping some data to HTTPie, this flag should be used in scripts.\n\nAlso, it's might be good to override the default ``30`` second ``--timeout`` to\nsomething that suits you.\n\n\n\nMeta\n====\n\nInterface design\n----------------\n\nThe syntax of the command arguments closely corresponds to the actual HTTP\nrequests sent over the wire. It has the advantage that it's easy to remember\nand read. It is often possible to translate an HTTP request to an HTTPie\nargument list just by inlining the request elements. For example, compare this\nHTTP request:\n\n.. code-block:: http\n\n POST /collection HTTP/1.1\n X-API-Key: 123\n User-Agent: Bacon/1.0\n Content-Type: application/x-www-form-urlencoded\n\n name=value&name2=value2\n\n\nwith the HTTPie command that sends it:\n\n.. code-block:: bash\n\n $ http -f POST example.org/collection \\\n X-API-Key:123 \\\n User-Agent:Bacon/1.0 \\\n name=value \\\n name2=value2\n\n\nNotice that both the order of elements and the syntax is very similar,\nand that only a small portion of the command is used to control HTTPie and\ndoesn't directly correspond to any part of the request (here it's only ``-f``\nasking HTTPie to send a form request).\n\nThe two modes, ``--pretty=all`` (default for terminal) and ``--pretty=none``\n(default for redirected output), allow for both user-friendly interactive use\nand usage from scripts, where HTTPie serves as a generic HTTP client.\n\nAs HTTPie is still under heavy development, the existing command line\nsyntax and some of the ``--OPTIONS`` may change slightly before\nHTTPie reaches its final version ``1.0``. All changes are recorded in the\n`change log`_.\n\n\n\nUser support\n------------\n\nPlease use the following support channels:\n\n* `GitHub issues `_\n for bug reports and feature requests.\n* `Our Gitter chat room `_\n to ask questions, discuss features, and for general discussion.\n* `StackOverflow `_\n to ask questions (please make sure to use the\n `httpie `_ tag).\n* Tweet directly to `@clihttp `_.\n* You can also tweet directly to `@jkbrzt`_.\n\n\nRelated projects\n----------------\n\nDependencies\n~~~~~~~~~~~~\n\nUnder the hood, HTTPie uses these two amazing libraries:\n\n* `Requests `_\n \u2014 Python HTTP library for humans\n* `Pygments `_\n \u2014 Python syntax highlighter\n\n\nHTTPie friends\n~~~~~~~~~~~~~~\n\nHTTPie plays exceptionally well with the following tools:\n\n* `jq `_\n \u2014 CLI JSON processor that\n works great in conjunction with HTTPie\n* `http-prompt `_\n \u2014 interactive shell for HTTPie featuring autocomplete\n and command syntax highlighting\n\n\nContributing\n------------\n\nSee `CONTRIBUTING.rst `_.\n\n\nChange log\n----------\n\nSee `CHANGELOG `_.\n\n\nArtwork\n-------\n\nSee `claudiatd/httpie-artwork`_\n\n\nLicence\n-------\n\nBSD-3-Clause: `LICENSE `_.\n\n\n\nAuthors\n-------\n\n`Jakub Roztocil`_ (`@jkbrzt`_) created HTTPie and `these fine people`_\nhave contributed.\n\n\n.. _pip: http://www.pip-installer.org/en/latest/index.html\n.. _Github API: http://developer.github.com/v3/issues/comments/#create-a-comment\n.. _these fine people: https://github.com/jkbrzt/httpie/contributors\n.. _Jakub Roztocil: http://roztocil.co\n.. _@jkbrzt: https://twitter.com/jkbrzt\n.. _claudiatd/httpie-artwork: https://github.com/claudiatd/httpie-artwork\n\n\n.. |pypi| image:: https://img.shields.io/pypi/v/httpie.svg?style=flat-square&label=latest%20stable%20version\n :target: https://pypi.python.org/pypi/httpie\n :alt: Latest version released on PyPi\n\n.. |coverage| image:: https://img.shields.io/coveralls/jkbrzt/httpie/master.svg?style=flat-square&label=coverage\n :target: https://coveralls.io/r/jkbrzt/httpie?branch=master\n :alt: Test coverage\n\n.. |unix_build| image:: https://img.shields.io/travis/jkbrzt/httpie/master.svg?style=flat-square&label=unix%20build\n :target: http://travis-ci.org/jkbrzt/httpie\n :alt: Build status of the master branch on Mac/Linux\n\n.. |windows_build| image:: https://img.shields.io/appveyor/ci/jkbrzt/httpie.svg?style=flat-square&label=windows%20build\n :target: https://ci.appveyor.com/project/jkbrzt/httpie\n :alt: Build status of the master branch on Windows\n\n.. |gitter| image:: https://badges.gitter.im/jkbrzt/httpie.svg\n :target: https://gitter.im/jkbrzt/httpie\n :alt: Chat on Gitter", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/jkbrzt/httpie", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://httpie.org/", "keywords": null, "license": "bsd", "maintainer": null, "maintainer_email": null, "name": "readme-test", "package_url": "https://pypi.org/project/readme-test/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/readme-test/", "project_urls": { "Download": "https://github.com/jkbrzt/httpie", "Homepage": "http://httpie.org/" }, "release_url": "https://pypi.org/project/readme-test/8.9.1/", "requires_dist": null, "requires_python": null, "summary": "testing readme rendering on pypi", "version": "8.9.1" }, "last_serial": 2508549, "releases": { "0.1.5": [ { "comment_text": "", "digests": { "md5": "83fbf51069fc8a9ee6b25105fa314c71", "sha256": "73487915f2647d9b93d2f5340c9c7b28d7c7ed0da083d27a5bbc7c14e234b946" }, "downloads": -1, "filename": "readme-test-0.1.5.tar.gz", "has_sig": false, "md5_digest": "83fbf51069fc8a9ee6b25105fa314c71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44042, "upload_time": "2016-12-09T11:21:34", "url": "https://files.pythonhosted.org/packages/e5/dc/99e6460245d218389c8ca01cc2fcf041c1eaae3f349491d34cdb9a4d115d/readme-test-0.1.5.tar.gz" } ], "1": [], "2.0.0": [ { "comment_text": "", "digests": { "md5": "9a2330051f3dafea7e466f37e18c8243", "sha256": "e07ec8a311000ecc8090a316a64737f27e13be1b07ffca4c2195ffb56c35689d" }, "downloads": -1, "filename": "readme-test-2.0.0.tar.gz", "has_sig": false, "md5_digest": "9a2330051f3dafea7e466f37e18c8243", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43968, "upload_time": "2016-12-09T11:25:38", "url": "https://files.pythonhosted.org/packages/0a/19/95a25c92568275178c0e61d10003599474a6574a96538879ac9f48afd31a/readme-test-2.0.0.tar.gz" } ], "5.3.9": [ { "comment_text": "", "digests": { "md5": "c23ee488b3689cf9531503c745f02858", "sha256": "0286d4fb554ad5644bb9921973eb2ade98de6a841fe4fb16332636c1a401281f" }, "downloads": -1, "filename": "readme-test-5.3.9.tar.gz", "has_sig": false, "md5_digest": "c23ee488b3689cf9531503c745f02858", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44042, "upload_time": "2016-12-09T11:25:14", "url": "https://files.pythonhosted.org/packages/4f/d2/5c8f0f28df7cd6a988e9fe0cb05385a0995f73a2b5c8989773438bf384cf/readme-test-5.3.9.tar.gz" } ], "8.9.1": [ { "comment_text": "", "digests": { "md5": "ee329b543992c27ff066e59df6949441", "sha256": "3781652a25c1c684d993668c49a53e6c2f7225723ddb3c51f1dc513fbb9314ad" }, "downloads": -1, "filename": "readme-test-8.9.1.tar.gz", "has_sig": false, "md5_digest": "ee329b543992c27ff066e59df6949441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44613, "upload_time": "2016-12-08T23:22:32", "url": "https://files.pythonhosted.org/packages/b3/fc/4c2a9ae50fc7d0edecb9d05d6a2e62b1678896dd3a1cf0c343ad96a0e71b/readme-test-8.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ee329b543992c27ff066e59df6949441", "sha256": "3781652a25c1c684d993668c49a53e6c2f7225723ddb3c51f1dc513fbb9314ad" }, "downloads": -1, "filename": "readme-test-8.9.1.tar.gz", "has_sig": false, "md5_digest": "ee329b543992c27ff066e59df6949441", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44613, "upload_time": "2016-12-08T23:22:32", "url": "https://files.pythonhosted.org/packages/b3/fc/4c2a9ae50fc7d0edecb9d05d6a2e62b1678896dd3a1cf0c343ad96a0e71b/readme-test-8.9.1.tar.gz" } ] }