Compare commits

..

64 Commits
0.9.2 ... 0.9.3

Author SHA1 Message Date
4722076335 v0.9.3 2016-01-01 19:27:07 -03:00
f14a0ad37d Fix pytest configuration 2016-01-01 19:11:22 -03:00
4cadc1d4c0 Update pytest configuration
* Move it from tox.ini to pytest.ini
* Ignore tests/fixtures
2016-01-01 19:08:27 -03:00
c3e5456aba Update setuptools on Appveyor 2016-01-01 19:01:39 -03:00
33489c9a91 Update pip on Appveyor 2016-01-01 18:51:17 -03:00
4e2b6b0ccc Update get-pip.py URL 2016-01-01 18:46:01 -03:00
b034c8703a PEP8 2016-01-01 18:41:58 -03:00
ab3d2656af Undo 'Fix "mock requires setuptools>=17.1. Aborting installation" on Win+Py3' 2016-01-01 18:38:06 -03:00
c42bd0051a Merge pull request #396 from pathcl/master
PEP8 errors
2016-01-01 18:37:49 -03:00
288cb4fdeb Fix "mock requires setuptools>=17.1. Aborting installation" on Win+Py3 2016-01-01 18:27:43 -03:00
8771d759fe Merge pull request #382 from konopski/master
[#381] Fixed --auth prompt on Windows
2016-01-01 18:18:23 -03:00
2cdca36960 Merge pull request #386 from honorabrutroll/dev
Fixed --pretty on Windows (closes #372)
2016-01-01 18:15:50 -03:00
8dc4f04fda Merge pull request #419 from hangtwenty/master
Fail gracefully if disable_warnings not available
2016-01-01 17:58:23 -03:00
dadc0cd27c Merge pull request #417 from yansal/patch-1
Fix typo in CONTRIBUTING.rst
2016-01-01 17:57:48 -03:00
59fd42244a Merge pull request #421 from Altreus/patch-1
Aitch already has an official spelling - use it
2016-01-01 17:56:52 -03:00
6afe9c32c4 Merge pull request #424 from t-mart/master
Remove duplicate setup.py test option
2015-12-28 13:56:14 -03:00
cc0ba03290 Remove duplicate setup.py test option 2015-12-28 10:38:07 -06:00
fad84a962e Aitch already has an official spelling - use it
http://www.oxforddictionaries.com/definition/english/aitch
2015-12-15 14:39:26 +00:00
4f755a8bde Fail gracefully if disable_warnings not available
Addresses #418. Rationale explained there.
2015-12-02 11:50:48 -06:00
21ee981fc6 Fix typo in CONTRIBUTING.rst 2015-11-27 15:02:23 +01:00
45df860124 PEP8 errors 2015-10-22 14:32:16 -03:00
277da1ff93 str conversion 2015-10-21 21:57:06 +02:00
1ded5c2a97 Merge pull request #387 from yurimalheiros/patch-1
Update README.rst
2015-10-07 19:41:24 +02:00
69bd72ce95 Update README.rst
Fix a simple typo
2015-10-07 14:17:53 -03:00
8bf6db471b Fixed AUTHORS.rst 2015-10-04 17:16:41 -05:00
b1cc069fce Add Edward Yang to AUTHORS.rst 2015-10-04 17:06:54 -05:00
ed484c278b Change pretty option processor to only raise error when using output file 2015-10-04 17:06:00 -05:00
aec0f04f5d [#381] --auth fails on windows 2015-09-21 16:30:46 +02:00
8eb460a6f3 Disable OSX travis builds for now
OSX/Python support isn't probably not ready on Travis' side yet. 

https://travis-ci.org/jkbrzt/httpie/jobs/78219565#L27

// cc @msabramo — any idea?
2015-09-11 16:24:42 +02:00
5fe5958b06 Update README.rst 2015-09-01 15:11:36 +02:00
0e1c17daa1 Merge pull request #375 from hoatle/jwt-auth-plugin-reference
mention httpie-jwt-auth plugin on README
2015-09-01 15:10:41 +02:00
307517e7ef Merge pull request #377 from mblayman/fix-trasnsport
Fix trasnsport typo in plugin manager.
2015-08-31 06:20:01 +02:00
d60a04da2d Add Matt Layman to AUTHORS. 2015-08-30 21:41:14 -04:00
9ea89ffefe Fix typo in method name of plugin manager. 2015-08-30 21:37:47 -04:00
bebeb2100d mention httpie-jwt-auth plugin on README 2015-08-24 01:58:00 +07:00
2b51cb6687 Updated links II. 2015-07-03 18:55:45 +02:00
fa4bd033ef Updated links. 2015-07-03 03:40:38 +02:00
f8c1104429 Fixed link to httpie-edgegrid 2015-06-30 11:51:40 +02:00
be9d9281b7 Added a link to the httpie-edgegrid plugin. 2015-06-30 11:50:11 +02:00
ced0838598 Converted tabs to spaces. 2015-06-26 16:39:23 +02:00
d8b819b03f Merge pull request #337 from joaodelgado/json-serialization
Only serialize json if data is a dict instance
2015-04-24 15:07:16 +02:00
6fd0f23f39 Only serialize json if data is a dict instance 2015-04-11 02:11:22 +01:00
483546d781 Added mock to tests_require 2015-03-25 22:52:49 +01:00
daf3573908 Update CHANGELOG.rst 2015-03-25 22:37:48 +01:00
62407f781f Update CHANGELOG.rst 2015-03-25 22:35:36 +01:00
cbbaac13ea Merge pull request #300 from msabramo/print_info_about_request_on_error
Print info about request on error
2015-03-25 22:21:18 +01:00
6aad79d71c Merge pull request #319 from fay-jai/license
Update license with up-to-date year
2015-03-25 22:18:42 +01:00
c1f26347fc Merge pull request #330 from mihirvj/bash-completion
Bash auto completion
2015-03-25 22:08:13 +01:00
29a0147dd5 See #326
Adds bash completion to http command line interface.

Installing the script:
You can copy it to /etc/bash_completion.d/ (or something else on your
machine) and source it using following command

	$ source /etc/profile

Now whenever you encounter a "-*" on your CLI, it presents you with the
options specified.

Couple of things that are still under work:
1) Adding this bash script to setup, so that user won't need manual
installation
2) Adding more options for HTTP (GET, PUT and so on) and other
options
2015-03-24 22:26:10 -04:00
ab0d1fd8d0 Added .editorconfig. 2015-03-13 17:17:17 +01:00
35a3dd2855 Merge pull request #321 from ifdattic/patch-1
Fix typos, improve readability
2015-03-10 09:37:40 +01:00
ece85c0f0c Fix typos, improve readability 2015-03-10 10:05:13 +02:00
798cd4f0ec Update license with up-to-date year 2015-03-08 11:29:33 -07:00
1a43c0e5f7 Fixed --debug output 2015-02-28 17:02:05 +01:00
fdabbc6048 Typo 2015-02-24 16:50:02 +01:00
5f3de558cb README 2015-02-24 16:41:34 +01:00
fdae686e12 Clean up compat and fix is_pypy. 2015-02-24 08:18:03 +01:00
1c181a5d25 1.0.0-dev 2015-02-24 07:52:34 +01:00
a228399801 0.9.2 2015-02-24 07:50:15 +01:00
bada3b45f1 Use absolute links to LICENCE, etc. 2015-02-24 07:50:15 +01:00
e4bc363f9e Don't depend on requests.compat
#314
2015-02-24 07:50:15 +01:00
24957e3b61 Update requirements-dev.txt
dd7f1c4
2015-02-16 21:55:40 +01:00
f855de16c2 Increase test coverage for error handling 2015-02-15 23:22:52 -08:00
7f8adad313 Print info about request on error
This can help in diagnosing certain issues. For example, if I were
trying to use a "http+unix" URL but I don't have #299, then I'll get the
following:

    [marca@marca-mac2 httpie]$ http http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid

    http: error: ConnectionError: ('Connection aborted.', gaierror(8, 'nodename nor servname provided, or not known'))
    while doing GET request to URL: http://http+unix//%2Ftmp%2Fprofilesvc.sock/status/pid

Having the URL in the error message is super useful here so that I know an
extra `http://` is getting prepended and it's not doing what I expected.
2015-02-15 23:22:52 -08:00
38 changed files with 257 additions and 139 deletions

17
.editorconfig Normal file
View File

@ -0,0 +1,17 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_size = 2
[Makefile]
indent_style = tab
indent_size = 8

View File

@ -1,8 +1,8 @@
# https://travis-ci.org/jakubroztocil/httpie
# https://travis-ci.org/jkbrzt/httpie
sudo: false
os:
- linux
- osx
# - osx
env:
global:
- NEWEST_PYTHON=3.4

View File

@ -2,7 +2,7 @@
HTTPie authors
==============
* `Jakub Roztocil <https://github.com/jakubroztocil>`_
* `Jakub Roztocil <https://github.com/jkbrzt>`_
Patches and ideas
@ -32,3 +32,5 @@ Patches and ideas
* `Nathan LaFreniere <https://github.com/nlf>`_
* `Matthias Lehmann <https://github.com/matleh>`_
* `Dennis Brakhane <https://github.com/brakhane>`_
* `Matt Layman <https://github.com/mblayman>`_
* `Edward Yang <https://github.com/honorabrutroll>`_

View File

@ -6,9 +6,16 @@ This document records all notable changes to `HTTPie <http://httpie.org>`_.
This project adheres to `Semantic Versioning <http://semver.org/>`_.
`1.0.0-dev`_ (Unreleased)
`0.9.3`_ (2016-01-01)
-------------------------
* Changed the default color ``--style`` from ``solarized`` to ``monokai``
* 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)
@ -24,7 +31,7 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
* Added support for Requests transport adapter plugins
(see `httpie-unixsocket <https://github.com/msabramo/httpie-unixsocket>`_
and `httpie-http2 <https://github.com/jakubroztocil/httpie-http2>`_)
and `httpie-http2 <https://github.com/jkbrzt/httpie-http2>`_)
`0.9.0`_ (2015-01-31)
@ -228,25 +235,26 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
* Initial public release
.. _`0.1`: https://github.com/jakubroztocil/httpie/commit/b966efa
.. _0.1.4: https://github.com/jakubroztocil/httpie/compare/b966efa...0.1.4
.. _0.1.5: https://github.com/jakubroztocil/httpie/compare/0.1.4...0.1.5
.. _0.1.6: https://github.com/jakubroztocil/httpie/compare/0.1.5...0.1.6
.. _0.2.0: https://github.com/jakubroztocil/httpie/compare/0.1.6...0.2.0
.. _0.2.1: https://github.com/jakubroztocil/httpie/compare/0.2.0...0.2.1
.. _0.2.2: https://github.com/jakubroztocil/httpie/compare/0.2.1...0.2.2
.. _0.2.5: https://github.com/jakubroztocil/httpie/compare/0.2.2...0.2.5
.. _0.2.6: https://github.com/jakubroztocil/httpie/compare/0.2.5...0.2.6
.. _0.2.7: https://github.com/jakubroztocil/httpie/compare/0.2.5...0.2.7
.. _0.3.0: https://github.com/jakubroztocil/httpie/compare/0.2.7...0.3.0
.. _0.4.0: https://github.com/jakubroztocil/httpie/compare/0.3.0...0.4.0
.. _0.4.1: https://github.com/jakubroztocil/httpie/compare/0.4.0...0.4.1
.. _0.5.0: https://github.com/jakubroztocil/httpie/compare/0.4.1...0.5.0
.. _0.5.1: https://github.com/jakubroztocil/httpie/compare/0.5.0...0.5.1
.. _0.6.0: https://github.com/jakubroztocil/httpie/compare/0.5.1...0.6.0
.. _0.7.1: https://github.com/jakubroztocil/httpie/compare/0.6.0...0.7.1
.. _0.8.0: https://github.com/jakubroztocil/httpie/compare/0.7.1...0.8.0
.. _0.9.0: https://github.com/jakubroztocil/httpie/compare/0.8.0...0.9.0
.. _0.9.1: https://github.com/jakubroztocil/httpie/compare/0.9.0...0.9.1
.. _0.9.2: https://github.com/jakubroztocil/httpie/compare/0.9.1...0.9.2
.. _1.0.0-dev: https://github.com/jakubroztocil/httpie/compare/0.9.2...master
.. _`0.1`: https://github.com/jkbrzt/httpie/commit/b966efa
.. _0.1.4: https://github.com/jkbrzt/httpie/compare/b966efa...0.1.4
.. _0.1.5: https://github.com/jkbrzt/httpie/compare/0.1.4...0.1.5
.. _0.1.6: https://github.com/jkbrzt/httpie/compare/0.1.5...0.1.6
.. _0.2.0: https://github.com/jkbrzt/httpie/compare/0.1.6...0.2.0
.. _0.2.1: https://github.com/jkbrzt/httpie/compare/0.2.0...0.2.1
.. _0.2.2: https://github.com/jkbrzt/httpie/compare/0.2.1...0.2.2
.. _0.2.5: https://github.com/jkbrzt/httpie/compare/0.2.2...0.2.5
.. _0.2.6: https://github.com/jkbrzt/httpie/compare/0.2.5...0.2.6
.. _0.2.7: https://github.com/jkbrzt/httpie/compare/0.2.5...0.2.7
.. _0.3.0: https://github.com/jkbrzt/httpie/compare/0.2.7...0.3.0
.. _0.4.0: https://github.com/jkbrzt/httpie/compare/0.3.0...0.4.0
.. _0.4.1: https://github.com/jkbrzt/httpie/compare/0.4.0...0.4.1
.. _0.5.0: https://github.com/jkbrzt/httpie/compare/0.4.1...0.5.0
.. _0.5.1: https://github.com/jkbrzt/httpie/compare/0.5.0...0.5.1
.. _0.6.0: https://github.com/jkbrzt/httpie/compare/0.5.1...0.6.0
.. _0.7.1: https://github.com/jkbrzt/httpie/compare/0.6.0...0.7.1
.. _0.8.0: https://github.com/jkbrzt/httpie/compare/0.7.1...0.8.0
.. _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
.. _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

View File

@ -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.
@ -87,9 +87,9 @@ Don't forget to add yourself to `AUTHORS.rst`_.
.. _Tox: http://tox.testrun.org
.. _supported Python environments: https://github.com/jakubroztocil/httpie/blob/master/tox.ini
.. _existing issues: https://github.com/jakubroztocil/httpie/issues?state=open
.. _AUTHORS.rst: https://github.com/jakubroztocil/httpie/blob/master/AUTHORS.rst
.. _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
.. _pytest: http://pytest.org/
.. _Style Guide for Python Code: http://python.org/dev/peps/pep-0008/
.. _test suite: https://github.com/jakubroztocil/httpie/tree/master/tests
.. _test suite: https://github.com/jkbrzt/httpie/tree/master/tests

View File

@ -1,4 +1,4 @@
Copyright © 2012 Jakub Roztocil <jakub@roztocil.co>
Copyright © 2012-2015 Jakub Roztocil <jakub@roztocil.co>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

View File

@ -2,15 +2,15 @@
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.
.. image:: httpie.png
.. image:: https://raw.githubusercontent.com/jkbrzt/httpie/master/httpie.png
:alt: HTTPie compared to cURL
:width: 679
:height: 781
@ -58,9 +58,6 @@ Main Features
Installation
============
--------------
Stable version
--------------
On **Mac OS X**, HTTPie can be installed via `Homebrew <http://brew.sh/>`_:
@ -70,7 +67,7 @@ On **Mac OS X**, HTTPie can be installed via `Homebrew <http://brew.sh/>`_:
Most **Linux** distributions provide a package that can be installed using the
the system package manager, e.g.:
system package manager, e.g.:
.. code-block:: bash
@ -109,7 +106,7 @@ The **latest development version** can be installed directly from GitHub:
$ brew install httpie --HEAD
# Universal
$ pip install --upgrade https://github.com/jakubroztocil/httpie/tarball/master
$ pip install --upgrade https://github.com/jkbrzt/httpie/tarball/master
@ -162,12 +159,12 @@ See the request that is being sent using one of the `output options`_:
Use `Github API`_ to post a comment on an
`issue <https://github.com/jakubroztocil/httpie/issues/83>`_
`issue <https://github.com/jkbrzt/httpie/issues/83>`_
with `authentication`_:
.. code-block:: bash
$ http -a USERNAME POST https://api.github.com/repos/jakubroztocil/httpie/issues/83/comments body='HTTPie is awesome!'
$ http -a USERNAME POST https://api.github.com/repos/jkbrzt/httpie/issues/83/comments body='HTTPie is awesome!'
Upload a file using `redirected input`_:
@ -280,7 +277,7 @@ If the port is omitted, then port 80 is assumed.
GET / HTTP/1.1
Host: localhost
If find yourself manually constructing URLs with **querystring parameters**
If you find yourself manually constructing URLs with **querystring parameters**
on the terminal, you may appreciate the ``param==value`` syntax for appending
URL parameters so that you don't have to worry about escaping the ``&``
separators. To search for ``HTTPie`` on Google Images you could use this
@ -318,7 +315,7 @@ their type is distinguished only by the separator used:
+-----------------------+-----------------------------------------------------+
| URL parameters | Appends the given name/value pair as a query |
| ``name==value`` | string parameter to the URL. |
| | The ``==`` separator is used |
| | The ``==`` separator is used. |
+-----------------------+-----------------------------------------------------+
| Data Fields | Request data fields to be serialized as a JSON |
| ``field=value``, | object (default), or to be form-encoded |
@ -449,7 +446,8 @@ Regular Forms
.. code-block:: bash
$ http --form POST api.example.org/person/1 name='John Smith' email=john@example.org cv=@~/Documents/cv.txt
$ http --form POST api.example.org/person/1 name='John Smith' \
email=john@example.org cv=@~/Documents/cv.txt
.. code-block:: http
@ -494,7 +492,8 @@ To set custom headers you can use the ``Header:Value`` notation:
.. code-block:: bash
$ http example.org User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' X-Foo:Bar Referer:http://httpie.org/
$ http example.org User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' \
X-Foo:Bar Referer:http://httpie.org/
.. code-block:: http
@ -535,7 +534,7 @@ The currently supported authentication schemes are Basic and Digest
the argument. Or, if you only specify a username
(``-a username``), you'll be prompted for
the password before the request is sent.
To send a an empty password, pass ``username:``.
To send an empty password, pass ``username:``.
The ``username:password@hostname`` URL syntax is
supported as well (but credentials passed via ``-a``
have higher priority).
@ -588,11 +587,13 @@ Authorization information from your ``~/.netrc`` file is honored as well:
Auth Plugins
------------
* `httpie-oauth <https://github.com/jakubroztocil/httpie-oauth>`_: OAuth
* `httpie-ntlm <https://github.com/jakubroztocil/httpie-ntlm>`_: NTLM (NT LAN Manager)
* `httpie-oauth <https://github.com/jkbrzt/httpie-oauth>`_: OAuth
* `httpie-ntlm <https://github.com/jkbrzt/httpie-ntlm>`_: NTLM (NT LAN Manager)
* `httpie-negotiate <https://github.com/ndzou/httpie-negotiate>`_: SPNEGO (GSS Negotiate)
* `requests-hawk <https://github.com/mozilla-services/requests-hawk>`_: Hawk
* `httpie-api-auth <https://github.com/pd/httpie-api-auth>`_: ApiAuth
* `httpie-edgegrid <https://github.com/akamai-open/httpie-edgegrid>`_: EdgeGrid
* `httpie-jwt-auth <https://github.com/teracyhq/httpie-jwt-auth>`_: JWTAuth (JSON Web Tokens)
=======
@ -824,7 +825,7 @@ You can even pipe web services together using HTTPie:
.. code-block:: bash
$ http GET https://api.github.com/repos/jakubroztocil/httpie | http POST httpbin.org/post
$ http GET https://api.github.com/repos/jkbrzt/httpie | http POST httpbin.org/post
You can use ``cat`` to enter multiline data on the terminal:
@ -894,7 +895,7 @@ Colors and Formatting
---------------------
Syntax highlighting is applied to HTTP headers and bodies (where it makes
sense). You can choose your prefered color scheme via the ``--style`` option
sense). You can choose your preferred color scheme via the ``--style`` option
if you don't like the default one (see ``$ http --help`` for the possible
values).
@ -1008,19 +1009,19 @@ is being saved to a file.
.. code-block:: bash
$ http --download https://github.com/jakubroztocil/httpie/tarball/master
$ http --download https://github.com/jkbrzt/httpie/tarball/master
.. code-block:: http
HTTP/1.1 200 OK
Connection: keep-alive
Content-Disposition: attachment; filename=jakubroztocil-httpie-0.4.1-33-gfc4f70a.tar.gz
Content-Disposition: attachment; filename=jkbrzt-httpie-0.4.1-33-gfc4f70a.tar.gz
Content-Length: 505530
Content-Type: application/x-gzip
Server: GitHub.com
Vary: Accept-Encoding
Downloading 494.89 kB to "jakubroztocil-httpie-0.4.1-33-gfc4f70a.tar.gz"
Downloading 494.89 kB to "jkbrzt-httpie-0.4.1-33-gfc4f70a.tar.gz"
/ 21.01% 104.00 kB 47.55 kB/s 0:00:08 ETA
@ -1034,7 +1035,7 @@ headers and progress are still shown in the terminal:
.. code-block:: bash
$ http -d https://github.com/jakubroztocil/httpie/tarball/master | tar zxf -
$ http -d https://github.com/jkbrzt/httpie/tarball/master | tar zxf -
If ``--output, -o`` is specified, you can resume a partial download using the
@ -1283,7 +1284,7 @@ Authors
=======
`Jakub Roztocil`_ (`@jakubroztocil`_) created HTTPie and `these fine people`_
`Jakub Roztocil`_ (`@jkbrzt`_) created HTTPie and `these fine people`_
have contributed.
@ -1298,21 +1299,21 @@ Please see `claudiatd/httpie-artwork`_
Contribute
==========
Please see `CONTRIBUTING <https://github.com/jakubroztocil/httpie/blob/master/CONTRIBUTING.rst>`_.
Please see `CONTRIBUTING <https://github.com/jkbrzt/httpie/blob/master/CONTRIBUTING.rst>`_.
==========
Change Log
==========
Please see `CHANGELOG <https://github.com/jakubroztocil/httpie/blob/master/CHANGELOG.rst>`_.
Please see `CHANGELOG <https://github.com/jkbrzt/httpie/blob/master/CHANGELOG.rst>`_.
=======
Licence
=======
Please see `LICENSE <https://github.com/jakubroztocil/httpie/blob/master/LICENSE>`_.
Please see `LICENSE <https://github.com/jkbrzt/httpie/blob/master/LICENSE>`_.
@ -1320,9 +1321,9 @@ Please see `LICENSE <https://github.com/jakubroztocil/httpie/blob/master/LICENSE
.. _Pygments: http://pygments.org/
.. _pip: http://www.pip-installer.org/en/latest/index.html
.. _Github API: http://developer.github.com/v3/issues/comments/#create-a-comment
.. _these fine people: https://github.com/jakubroztocil/httpie/contributors
.. _Jakub Roztocil: http://subtleapps.com
.. _@jakubroztocil: https://twitter.com/jakubroztocil
.. _these fine people: https://github.com/jkbrzt/httpie/contributors
.. _Jakub Roztocil: http://roztocil.co
.. _@jkbrzt: https://twitter.com/jkbrzt
.. _claudiatd/httpie-artwork: https://github.com/claudiatd/httpie-artwork
@ -1330,14 +1331,14 @@ Please see `LICENSE <https://github.com/jakubroztocil/httpie/blob/master/LICENSE
:target: https://pypi.python.org/pypi/httpie
:alt: Latest version released on PyPi
.. |coverage| image:: https://img.shields.io/coveralls/jakubroztocil/httpie/master.svg?style=flat-square
:target: https://coveralls.io/r/jakubroztocil/httpie?branch=master
.. |coverage| image:: https://img.shields.io/coveralls/jkbrzt/httpie/master.svg?style=flat-square
:target: https://coveralls.io/r/jkbrzt/httpie?branch=master
:alt: Test coverage
.. |unix_build| image:: https://img.shields.io/travis/jakubroztocil/httpie/master.svg?style=flat-square&label=unix%20build
:target: http://travis-ci.org/jakubroztocil/httpie
.. |unix_build| image:: https://img.shields.io/travis/jkbrzt/httpie/master.svg?style=flat-square&label=unix%20build
:target: http://travis-ci.org/jkbrzt/httpie
:alt: Build status of the master branch on Mac/Linux
.. |windows_build| image:: https://img.shields.io/appveyor/ci/jakubroztocil/httpie.svg?style=flat-square&label=windows%20build
:target: https://ci.appveyor.com/project/jakubroztocil/httpie
.. |windows_build| image:: https://img.shields.io/appveyor/ci/jkbrzt/httpie.svg?style=flat-square&label=windows%20build
:target: https://ci.appveyor.com/project/jkbrzt/httpie
:alt: Build status of the master branch on Windows

View File

@ -1,4 +1,4 @@
# https://ci.appveyor.com/project/jakubroztocil/httpie
# https://ci.appveyor.com/project/jkbrzt/httpie
build: false
environment:
matrix:
@ -8,8 +8,9 @@ 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')
- "%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 setuptools"
- "%PYTHON%/Scripts/pip.exe install -e ."
test_script:
- "%PYTHON%/Scripts/pip.exe --version"

23
httpie-completion.bash Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
_http_complete() {
local cur_word=${COMP_WORDS[COMP_CWORD]}
local prev_word=${COMP_WORDS[COMP_CWORD - 1]}
if [[ "$cur_word" == -* ]]; then
_http_complete_options "$cur_word"
fi
}
complete -o default -F _http_complete http
_http_complete_options() {
local cur_word=$1
local options="-j --json -f --form --pretty -s --style -p --print
-v --verbose -h --headers -b --body -S --stream -o --output -d --download
-c --continue --session --session-read-only -a --auth --auth-type --proxy
--follow --verify --cert --cert-key --timeout --check-status --ignore-stdin
--help --version --traceback --debug"
COMPREPLY=( $( compgen -W "$options" -- "$cur_word" ) )
}

View File

@ -3,7 +3,7 @@ HTTPie - a CLI, cURL-like tool for humans.
"""
__author__ = 'Jakub Roztocil'
__version__ = '0.9.2'
__version__ = '0.9.3'
__licence__ = 'BSD'

View File

@ -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)
@ -49,7 +49,7 @@ parser = Parser(
Suggestions and bug reports are greatly appreciated:
https://github.com/jakubroztocil/httpie/issues
https://github.com/jkbrzt/httpie/issues
""")
)

View File

@ -11,8 +11,15 @@ from httpie.compat import str
from httpie.plugins import plugin_manager
# https://urllib3.readthedocs.org/en/latest/security.html
urllib3.disable_warnings()
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.
pass
FORM = 'application/x-www-form-urlencoded; charset=utf-8'
@ -22,7 +29,7 @@ DEFAULT_UA = 'HTTPie/%s' % __version__
def get_requests_session():
requests_session = requests.Session()
for cls in plugin_manager.get_trasnsport_plugins():
for cls in plugin_manager.get_transport_plugins():
transport_plugin = cls()
requests_session.mount(prefix=transport_plugin.prefix,
adapter=transport_plugin.get_adapter())
@ -52,13 +59,13 @@ def get_response(args, config_dir):
def dump_request(kwargs):
sys.stderr.write('\n>>> requests.request(%s)\n\n'
sys.stderr.write('\n>>> requests.request(**%s)\n\n'
% pformat(kwargs))
def encode_headers(headers):
# This allows for unicode headers which is non-standard but practical.
# See: https://github.com/jakubroztocil/httpie/issues/212
# See: https://github.com/jkbrzt/httpie/issues/212
return dict(
(name, value.encode('utf8') if isinstance(value, str) else value)
for name, value in headers.items()
@ -92,7 +99,7 @@ def get_requests_kwargs(args, base_headers=None):
# Serialize JSON data, if needed.
data = args.data
auto_json = data and not args.form
if args.json or auto_json and isinstance(data, dict):
if (args.json or auto_json) and isinstance(data, dict):
if data:
data = json.dumps(data)
else:

View File

@ -5,13 +5,11 @@ Python 2.6, 2.7, and 3.x compatibility.
import sys
# Taken from `requests.compat`
_ver = sys.version_info
is_py2 = (_ver[0] == 2)
is_py26 = (is_py2 and _ver[1] == 6)
is_py27 = (is_py2 and _ver[1] == 7)
is_py3 = (_ver[0] == 3)
is_pypy = ('pypy' in _ver)
is_py2 = sys.version_info[0] == 2
is_py26 = sys.version_info[:2] == (2, 6)
is_py27 = sys.version_info[:2] == (2, 7)
is_py3 = sys.version_info[0] == 3
is_pypy = 'pypy' in sys.version.lower()
is_windows = 'win32' in str(sys.platform).lower()

View File

@ -80,7 +80,7 @@ class BaseConfigDict(dict):
class Config(BaseConfigDict):
name = 'config'
helpurl = 'https://github.com/jakubroztocil/httpie#config'
helpurl = 'https://github.com/jkbrzt/httpie#config'
about = 'HTTPie configuration file'
DEFAULTS = {

View File

@ -67,7 +67,7 @@ def decode_args(args, stdin_encoding):
]
def main(args=sys.argv[1:], env=Environment()):
def main(args=sys.argv[1:], env=Environment(), error=None):
"""Run the main program and write the output to ``env.stdout``.
Return exit status code.
@ -81,11 +81,14 @@ def main(args=sys.argv[1:], env=Environment()):
if env.config.default_options:
args = env.config.default_options + args
def error(msg, *args, **kwargs):
def _error(msg, *args, **kwargs):
msg = msg % args
level = kwargs.get('level', 'error')
env.stderr.write('\nhttp: %s: %s\n' % (level, msg))
if error is None:
error = _error
debug = '--debug' in args
traceback = debug or '--traceback' in args
exit_status = ExitStatus.OK
@ -183,7 +186,13 @@ def main(args=sys.argv[1:], env=Environment()):
# Network errors vs. bugs, etc.
if traceback:
raise
error('%s: %s', type(e).__name__, str(e))
msg = str(e)
if hasattr(e, 'request'):
request = e.request
if hasattr(request, 'url'):
msg += ' while doing %s request to URL: %s' % (
request.method, request.url)
error('%s: %s', type(e).__name__, msg)
exit_status = ExitStatus.ERROR
finally:

View File

@ -104,7 +104,7 @@ def filename_from_content_disposition(content_disposition):
:return: the filename if present and valid, otherwise `None`
"""
# attachment; filename=jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz
# attachment; filename=jkbrzt-httpie-0.4.1-20-g40bd8f6.tar.gz
msg = Message('Content-Disposition: %s' % content_disposition)
filename = msg.get_filename()

View File

@ -13,7 +13,7 @@ from collections import namedtuple, Iterable
from argparse import ArgumentParser, ArgumentTypeError, ArgumentError
# TODO: Use MultiDict for headers once added to `requests`.
# https://github.com/jakubroztocil/httpie/issues/130
# https://github.com/jkbrzt/httpie/issues/130
from requests.structures import CaseInsensitiveDict
from httpie.compat import OrderedDict, urlsplit, str, is_pypy, is_py27
@ -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
@ -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
@ -521,7 +522,7 @@ class AuthCredentials(KeyValue):
def _getpass(self, prompt):
# To allow mocking.
return getpass.getpass(prompt)
return getpass.getpass(str(prompt))
def has_password(self):
return self.value is not None
@ -572,7 +573,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.

View File

@ -14,7 +14,7 @@ from httpie.plugins import FormatterPlugin
# great and fruity seems to give the best result there.
AVAILABLE_STYLES = set(pygments.styles.STYLE_MAP.keys())
AVAILABLE_STYLES.add('solarized')
DEFAULT_STYLE = 'solarized'
DEFAULT_STYLE = 'monokai'
class ColorFormatter(FormatterPlugin):

View File

@ -15,7 +15,7 @@ class AuthPlugin(BasePlugin):
"""
Base auth plugin class.
See <https://github.com/jakubroztocil/httpie-ntlm> for an example auth plugin.
See <https://github.com/jkbrzt/httpie-ntlm> for an example auth plugin.
"""
# The value that should be passed to --auth-type

View File

@ -16,7 +16,7 @@ class HTTPBasicAuth(requests.auth.HTTPBasicAuth):
"""
Override username/password serialization to allow unicode.
See https://github.com/jakubroztocil/httpie/issues/212
See https://github.com/jkbrzt/httpie/issues/212
"""
r.headers['Authorization'] = type(self).make_header(

View File

@ -60,6 +60,6 @@ class PluginManager(object):
if issubclass(plugin, ConverterPlugin)]
# Adapters
def get_trasnsport_plugins(self):
def get_transport_plugins(self):
return [plugin for plugin in self
if issubclass(plugin, TransportPlugin)]

View File

@ -75,7 +75,7 @@ def get_response(requests_session, session_name,
class Session(BaseConfigDict):
helpurl = 'https://github.com/jakubroztocil/httpie#sessions'
helpurl = 'https://github.com/jkbrzt/httpie#sessions'
about = 'HTTPie session file'
def __init__(self, path, *args, **kwargs):

View File

@ -54,4 +54,3 @@ def humanize_bytes(n, precision=2):
# noinspection PyUnboundLocalVariable
return '%.*f %s' % (precision, n / factor, suffix)

3
pytest.ini Normal file
View File

@ -0,0 +1,3 @@
[pytest]
addopts = --tb=native
norecursedirs = tests/fixtures

View File

@ -1,6 +1,7 @@
tox
mock
pytest
pytest-cov
pytest-httpbin
pytest-httpbin>=0.0.6
docutils
wheel

View File

@ -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'
@ -31,6 +30,7 @@ tests_require = [
# https://bitbucket.org/pypa/setuptools/issue/196/
'pytest-httpbin',
'pytest',
'mock',
]
@ -39,12 +39,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')
@ -74,9 +74,9 @@ setup(
description=httpie.__doc__.strip(),
long_description=long_description(),
url='http://httpie.org/',
download_url='https://github.com/jakubroztocil/httpie',
download_url='https://github.com/jkbrzt/httpie',
author=httpie.__author__,
author_email='jakub@roztocil.name',
author_email='jakub@roztocil.co',
license=httpie.__licence__,
packages=find_packages(),
entry_points={

View File

@ -5,4 +5,4 @@ HTTPie Test Suite
Please see `CONTRIBUTING`_.
.. _CONTRIBUTING: https://github.com/jakubroztocil/httpie/blob/master/CONTRIBUTING.rst
.. _CONTRIBUTING: https://github.com/jkbrzt/httpie/blob/master/CONTRIBUTING.rst

View File

@ -38,4 +38,3 @@ with open(BIN_FILE_PATH, 'rb') as f:
BIN_FILE_CONTENT = f.read()
UNICODE = FILE_CONTENT

View File

@ -52,11 +52,10 @@ class TestAuth:
])
def test_only_username_in_url(self, url):
"""
https://github.com/jakubroztocil/httpie/issues/242
https://github.com/jkbrzt/httpie/issues/242
"""
args = httpie.cli.parser.parse_args(args=[url], env=TestEnvironment())
assert args.auth
assert args.auth.key == 'username'
assert args.auth.value == ''

View File

@ -42,7 +42,7 @@ class TestAutoContentTypeAndAcceptHeaders:
"""
def test_GET_no_data_no_auto_headers(self, httpbin):
# https://github.com/jakubroztocil/httpie/issues/62
# https://github.com/jkbrzt/httpie/issues/62
r = http('GET', httpbin.url + '/headers')
assert HTTP_OK in r
assert r.json['headers']['Accept'] == '*/*'
@ -73,7 +73,7 @@ class TestAutoContentTypeAndAcceptHeaders:
assert HTTP_OK in r
assert r.json['headers']['Accept'] == 'application/json'
# Make sure Content-Type gets set even with no data.
# https://github.com/jakubroztocil/httpie/issues/137
# https://github.com/jkbrzt/httpie/issues/137
assert 'application/json' in r.json['headers']['Content-Type']
def test_GET_explicit_JSON_explicit_headers(self, httpbin):

View File

@ -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

48
tests/test_errors.py Normal file
View File

@ -0,0 +1,48 @@
import mock
from pytest import raises
from requests import Request, Timeout
from requests.exceptions import ConnectionError
from httpie.core import main
error_msg = None
@mock.patch('httpie.core.get_response')
def test_error(get_response):
def error(msg, *args, **kwargs):
global error_msg
error_msg = msg % args
exc = ConnectionError('Connection aborted')
exc.request = Request(method='GET', url='http://www.google.com')
get_response.side_effect = exc
ret = main(['--ignore-stdin', 'www.google.com'], error=error)
assert ret == 1
assert error_msg == (
'ConnectionError: '
'Connection aborted while doing GET request to URL: '
'http://www.google.com')
@mock.patch('httpie.core.get_response')
def test_error_traceback(get_response):
exc = ConnectionError('Connection aborted')
exc.request = Request(method='GET', url='http://www.google.com')
get_response.side_effect = exc
with raises(ConnectionError):
ret = main(['--ignore-stdin', '--traceback', 'www.google.com'])
@mock.patch('httpie.core.get_response')
def test_timeout(get_response):
def error(msg, *args, **kwargs):
global error_msg
error_msg = msg % args
exc = Timeout('Request timed out')
exc.request = Request(method='GET', url='http://www.google.com')
get_response.side_effect = exc
ret = main(['--ignore-stdin', 'www.google.com'], error=error)
assert ret == 2
assert error_msg == 'Request timed out (30s).'

View File

@ -18,7 +18,7 @@ class TestHTTPie:
def test_help(self):
r = http('--help', error_exit_ok=True)
assert r.exit_status == httpie.ExitStatus.OK
assert 'https://github.com/jakubroztocil/httpie/issues' in r
assert 'https://github.com/jkbrzt/httpie/issues' in r
def test_version(self):
r = http('--version', error_exit_ok=True)

View File

@ -13,7 +13,7 @@ class TestVerboseFlag:
assert r.count('__test__') == 2
def test_verbose_form(self, httpbin):
# https://github.com/jakubroztocil/httpie/issues/53
# https://github.com/jkbrzt/httpie/issues/53
r = http('--verbose', '--form', 'POST', httpbin.url + '/post',
'A=B', 'C=D')
assert HTTP_OK in r

View File

@ -7,7 +7,7 @@ from httpie.compat import is_windows
def test_Host_header_overwrite(httpbin):
"""
https://github.com/jakubroztocil/httpie/issues/235
https://github.com/jkbrzt/httpie/issues/235
"""
host = 'httpbin.org'
@ -21,7 +21,7 @@ def test_Host_header_overwrite(httpbin):
@pytest.mark.skipif(is_windows, reason='Unix-only')
def test_output_devnull(httpbin):
"""
https://github.com/jakubroztocil/httpie/issues/252
https://github.com/jkbrzt/httpie/issues/252
"""
http('--output=/dev/null', httpbin + '/get')

View File

@ -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']
@ -138,7 +143,7 @@ class TestSession(SessionTestBase):
@pytest.mark.skipif(
sys.version_info >= (3,),
reason="This test fails intermittently on Python 3 - "
"see https://github.com/jakubroztocil/httpie/issues/282")
"see https://github.com/jkbrzt/httpie/issues/282")
def test_session_unicode(self, httpbin):
self.start_session(httpbin)
@ -159,7 +164,7 @@ class TestSession(SessionTestBase):
def test_session_default_header_value_overwritten(self, httpbin):
self.start_session(httpbin)
# https://github.com/jakubroztocil/httpie/issues/180
# https://github.com/jkbrzt/httpie/issues/180
r1 = http('--session=test',
httpbin.url + '/headers', 'User-Agent:custom',
env=self.env())

View File

@ -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]

View File

@ -16,6 +16,3 @@ deps =
commands =
py.test --verbose --doctest-modules --basetemp={envtmpdir} {posargs:./tests ./httpie}
[pytest]
addopts = --tb=native