Commit Graph

531 Commits

Author SHA1 Message Date
Jakub Roztocil
2efc0db8d4 Cleanup 2016-11-24 00:58:41 +01:00
Jakub Roztocil
2bf71af286 pep8 2016-11-23 23:36:46 +01:00
Jakub Roztocil
3f7ed35238 Add more plugin API tests 2016-11-23 23:09:45 +01:00
Jakub Roztocil
47fd392c74 Cleanup 2016-11-23 22:33:22 +01:00
Jakub Roztocil
54a63a810e Cleanup/docstring 2016-11-23 22:29:36 +01:00
Jakub Roztocil
a49774d3ab Extend auth plugin API
This extends the `AuthPlugin` API by the following attributes:

* `auth_require`: set to `False` to make `--auth, -a` optional
* `auth_parse`: set to `False` to disable `username:password` parsing
  (access the raw value passed to `-a` via `self.raw_auth`).
* `prompt_password`: set to`False` to disable password prompt when
   no password provided (only relevant when `auth_parse == True`)

 These changes should be 100% backwards-compatible.

 What needs more testing is auth support in sessions.

Close #433
Close #431
Close #378
Ping teracyhq/httpie-jwt-auth#3
2016-11-23 22:02:12 +01:00
Jakub Roztocil
9b23a4ac9a Exit with status 130 on CTRL-C
http://www.tldp.org/LDP/abs/html/exitcodes.html

 #531
2016-10-26 11:53:01 +02:00
Jakub Roztocil
48a6d234cb Need a main()
#531
2016-10-26 11:21:30 +02:00
Jakub Roztocil
c6f2b32e36 Stricter KeyboardInterrupt silencing
Relates to #531, but doesn't solve it completely.
2016-10-26 11:16:39 +02:00
Jakub Roztocil
6bdfc7a071 Update config and session file help URLs 2016-09-12 10:57:30 +02:00
Jakub Roztocil
87e44ae639 Handle curses-free Pythons 2016-09-06 11:50:56 +01:00
dongweiming
c53a778f60 Fix Issue #496 2016-09-01 17:46:34 +08:00
Jakub Roztocil
8e96238323 v0.9.6 2016-08-13 23:01:05 +02:00
Jakub Roztocil
487c7a9221 v0.9.5 2016-08-13 22:51:42 +02:00
Jakub Roztocil
6d65668355 Strip request header values 2016-08-13 22:40:01 +02:00
KATO Kei
6b06d92a59 Fix typo 2016-07-27 09:54:26 +09:00
Pedro Rodrigues
8f6bee9196 codestyle fixes 2016-07-19 17:23:40 +01:00
Jakub Roztocil
aab5cd9da0 PEP8. clean-up 2016-07-04 20:30:55 +02:00
Jakub Roztocil
e1fa57d228 Added -I as a shortcut for --ignore-stdin 2016-07-02 15:01:46 +02:00
Jakub Roztocil
49a0fb6e0f More liberal default JSON Accept header
Closes #470
2016-07-02 14:18:36 +02:00
Jakub Roztocil
41e822ca2f Clean-up 2016-07-02 12:51:35 +02:00
Jakub Roztocil
1124d68946 Added --default-scheme <URL_SCHEME>
Closes #289
2016-07-02 12:47:02 +02:00
Jakub Roztočil
c3735d0422 Merge pull request #401 from lgarron/default-scheme
Add a --default-scheme argument.
2016-07-02 12:32:07 +02:00
Jakub Roztocil
5acbc904b7 Added the ability to unset headers
Closes #476
2016-07-02 11:50:30 +02:00
Jakub Roztocil
e25948f6a0 1.0.0-dev 2016-07-01 19:17:31 +02:00
Jakub Roztocil
b565b4628e v0.9.4 2016-07-01 19:02:34 +02:00
Jakub Roztocil
65081b2f12 Cleanup 2016-07-01 19:00:06 +02:00
Jakub Roztocil
963b2746f5 Be more liberal when detecting JSON in the formatter
Closes #485
2016-07-01 18:57:13 +02:00
Jakub Roztocil
098257c0be Rename --print-others to --history-print. 2016-07-01 18:49:27 +02:00
Rémy HUBSCHER
9fbe745987
Update readthedocs links. 2016-04-28 12:28:20 +02:00
Jakub Roztocil
293295cad6 Removed XML formatter
Closes #443
Closes #389
Closes #415
Closes #384
Closes #394
2016-03-18 09:16:39 +08:00
Jakub Roztocil
557911b606 Handle that os.pathconf is posix-only 2016-03-17 16:14:14 +08:00
Jakub Roztocil
5300b0b490 Fixed #451 - OSError: [Errno 36] File name too long 2016-03-17 15:58:01 +08:00
Jakub Roztocil
25d1e8e418 Add Accept-Encoding: identity for --download
#423
2016-03-07 11:46:59 +08:00
Jakub Roztocil
6e1dbadff9 Replace --show-redirects with --all and add --print-others, -P
With --all, any intermediary requests/responses are shown (such as redirects
 or the initial unauthorized Digest auth request).

 The --print-others, -P option works like --print, -p, but only applies to
 intermediary requests/responses. The default behaviour is to inherit
 the value of -p.
2016-03-07 07:04:23 +08:00
Jakub Roztocil
5e03aeceb7 Make fruity default style one Windows
(again)
2016-03-06 08:33:40 +08:00
Jakub Roztocil
bb49a1f979 Improved --debug output 2016-03-05 01:42:48 +08:00
Jakub Roztocil
20823c1702 Removed the "implicit_content_type" config option
If you used:

    "implicit_content_type": "form"

 You can achieve the the same result with:

     "default_options": ["--form"]

If you used:

    "implicit_content_type": "json"

 Then it's the default behaviour and it can be removed.

 In either case HTTPie will migrate your config file on the next invocation.
2016-03-03 17:14:39 +08:00
Jakub Roztocil
13a979ad11 Cleanup 2016-03-02 14:20:35 +08:00
Jakub Roztocil
66e168b2af Improved failed test output 2016-03-02 13:16:41 +08:00
Jakub Roztocil
ecbbad816a Fix coveralls integration 2016-03-02 12:24:46 +08:00
Jakub Roztocil
dc4da527db Added --ssl=<PROTOCOL_VERSION>
Closes #98
2016-03-02 12:12:05 +08:00
Jakub Roztocil
f6824f7ade Cleanup 2016-03-02 02:53:23 +08:00
Jakub Roztocil
0d2d24eac7 Copy 2016-03-01 21:37:26 +08:00
Jakub Roztocil
e2751e5fa3 Fixed args for Python 2.x 2016-03-01 21:28:10 +08:00
Jakub Roztocil
2a25d71aa4 Refactored main() into program() + main() 2016-03-01 21:10:54 +08:00
Jakub Roztocil
01ca7f0eb2 Ignore redirected stdout with --output, -o
This makes it easier to use HTTPie in cron jobs and scripts.

Closes #259
2016-03-01 20:24:50 +08:00
Jakub Roztocil
4f8d6c013b Fixed get_lexer() 2016-03-01 16:55:12 +08:00
Jakub Roztocil
345f5a02a2 Fixed json absolute import 2016-03-01 16:39:50 +08:00
Jakub Roztocil
f96f0ef9ed JSON detection improvements 2016-03-01 16:22:54 +08:00
Jakub Roztocil
74e4d0b678 Added JSON detection when `--json, -j` is set
To correctly format JSON responses even when an incorrect ``Content-Type`` is returned.

Closes #92
Closes #349
Closes #368
2016-03-01 14:57:15 +08:00
Jakub Roztocil
ed08ab133e Refactoring 2016-02-29 15:00:17 +08:00
Jakub Roztocil
e18b609ef7 Fixed --max-redirects 2016-02-29 14:21:25 +08:00
Jakub Roztocil
356e043651 Added --show-redirects and --max-redirects
Closes #157, #183, #188, #246
2016-02-29 14:12:09 +08:00
Jakub Roztocil
c6d4f6cdf6 Show redirects WIP 2016-02-29 14:07:08 +08:00
James Carr
dc1371d4d6 Implemented --max-redirects option
Added argument to argparse, changed client so that it uses a new
requests Session() with the number of redirects and a single test to
show the setting works.
2016-02-29 14:07:08 +08:00
Jakub Roztočil
25f0156502 Merge pull request #432 from hangtwenty/master
Add `-A` as short arg for `--auth-type`
2016-02-28 20:58:23 +08:00
Jakub Roztocil
0f8d04b4df More robust mime type parsing
Closes #344
2016-02-28 20:12:16 +08:00
Jakub Roztocil
5898879395 Fixed --download with --session
Closes #412
2016-02-28 19:14:10 +08:00
Jakub Roztocil
8c33e5e3d3 Parser => HTTPieArgumentParser 2016-02-28 19:01:54 +08:00
Jakub Roztocil
56f498c153 Detect Content Type of file uploaded in multipart/form-data request
Closes #271 #285 #398

This adds filename-based detection. It's still not possible to specify the
content type manually, though.
2016-02-28 15:49:01 +08:00
Marcin Szewczyk
59e22b16b8 When possible, guess the content-type of the file being sent
Refined PR #285 by rasky to pass all tests
2016-02-28 15:47:43 +08:00
Jakub Roztocil
274dddfb45 Changed the default color style back to solarized
Closes #440
2016-02-17 14:46:35 +08:00
Michael Floering
018e1f68de Merge remote-tracking branch 'upstream/master' 2016-01-22 18:40:53 -06:00
Michael Floering
ac69d4311b add -A as short arg for --auth-type
Addresses #430
comes with unit test
2016-01-22 18:37:30 -06:00
Jakub Roztocil
84b81c00ea Fixed tox.ini and improved tests and CONTRIBUTING.txt 2016-01-02 14:07:00 -03:00
Jakub Roztocil
34c6958dc8 1.0.0-dev 2016-01-01 19:38:21 -03:00
Jakub Roztocil
4722076335 v0.9.3 2016-01-01 19:27:07 -03:00
Jakub Roztocil
b034c8703a PEP8 2016-01-01 18:41:58 -03:00
Jakub Roztočil
c42bd0051a Merge pull request #396 from pathcl/master
PEP8 errors
2016-01-01 18:37:49 -03:00
Jakub Roztočil
8771d759fe Merge pull request #382 from konopski/master
[#381] Fixed --auth prompt on Windows
2016-01-01 18:18:23 -03:00
Jakub Roztočil
2cdca36960 Merge pull request #386 from honorabrutroll/dev
Fixed --pretty on Windows (closes #372)
2016-01-01 18:15:50 -03:00
Michael Floering
4f755a8bde Fail gracefully if disable_warnings not available
Addresses #418. Rationale explained there.
2015-12-02 11:50:48 -06:00
Lucas Garron
6259b5dd3b Add a --default-scheme argument. 2015-10-28 15:06:04 -07:00
Luis San Martin
45df860124 PEP8 errors 2015-10-22 14:32:16 -03:00
Lukasz Konopski
277da1ff93 str conversion 2015-10-21 21:57:06 +02:00
honorabrutroll
ed484c278b Change pretty option processor to only raise error when using output file 2015-10-04 17:06:00 -05:00
Lukasz Konopski
aec0f04f5d [#381] --auth fails on windows 2015-09-21 16:30:46 +02:00
Matt Layman
9ea89ffefe Fix typo in method name of plugin manager. 2015-08-30 21:37:47 -04:00
Jakub Roztocil
2b51cb6687 Updated links II. 2015-07-03 18:55:45 +02:00
Joao Delgado
6fd0f23f39 Only serialize json if data is a dict instance 2015-04-11 02:11:22 +01:00
Jakub Roztočil
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
Jakub Roztocil
1a43c0e5f7 Fixed --debug output 2015-02-28 17:02:05 +01:00
Jakub Roztocil
fdae686e12 Clean up compat and fix is_pypy. 2015-02-24 08:18:03 +01:00
Jakub Roztocil
1c181a5d25 1.0.0-dev 2015-02-24 07:52:34 +01:00
Jakub Roztocil
a228399801 0.9.2 2015-02-24 07:50:15 +01:00
Jakub Roztocil
e4bc363f9e Don't depend on requests.compat
#314
2015-02-24 07:50:15 +01:00
Jakub Roztocil
ecc59591f1 Disable urllib3's "Unverified HTTPS request is being made" warnings 2015-02-16 19:36:02 +01:00
Marc Abramowitz
f855de16c2 Increase test coverage for error handling 2015-02-15 23:22:52 -08:00
Marc Abramowitz
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
Jakub Roztocil
bc0d17c04c Added a PyPy incompatibility workaround. 2015-02-15 00:36:55 +01:00
Jakub Roztocil
985f65ef52 Temporarily skip SSL tests on PyPy due to #308 2015-02-14 23:14:06 +01:00
Jakub Roztocil
dd0a4ab87a Default --style to "monokai"
419ca85
2015-02-14 22:51:31 +01:00
Jakub Roztocil
419ca85e62 The default color --style is now "fruity"
It's experimental - please let me know should you dislike this change.

To make Solarized default again, add this to your ~/.config.json:

  "default_options": [
    "--style=solarized"
  ],
2015-02-14 18:18:04 +01:00
Jakub Roztocil
6e7e2f2eea Changed the default JSON Content-Type to application/json. 2015-02-14 17:45:15 +01:00
Marc Abramowitz
86ebb9b741 compat.py: Add pragma no covers
Cuz this is a lot of version-specific stuff and it can be confusing to have different coverage per version, especially with coveralls.
2015-02-10 06:54:59 -08:00
Jakub Roztocil
a786f17997 1.0.0-dev 2015-02-07 17:04:33 +01:00
Jakub Roztocil
753a8d04e4 v0.9.1 2015-02-07 17:04:13 +01:00
Jakub Roztocil
3ff03524ff HTTP/2 has no minor versions.
https://github.com/jakubroztocil/httpie-http2/issues/1
2015-02-07 16:31:42 +01:00
Jakub Roztocil
9682f955b5 Handle HTTP/2 responses
https://github.com/jakubroztocil/httpie-http2/issues/1#issuecomment-73301801
2015-02-06 21:13:57 +01:00
Jakub Roztocil
996e314482 Cleanup 2015-02-05 15:55:20 +01:00
Jakub Roztocil
687a6a734d Added support for transport adapter plugins
#276, #298
2015-02-05 15:25:00 +01:00
Jakub Roztocil
b125ce5eae Allow custom URL schemes
Closes #299

See also #276
2015-02-05 14:35:34 +01:00
Jakub Roztocil
530d6c5e27 1.0.0-dev 2015-01-31 13:22:17 +01:00
Jakub Roztocil
12f2d99bfd Added test client SSL certs 2015-01-23 23:56:08 +01:00
Jakub Roztocil
df07927843 --certkey is now --cert-key 2015-01-23 23:54:27 +01:00
Jakub Roztocil
d3d78afb6a Pypy3 (2.4.0) curses bug workaround. 2015-01-23 22:19:02 +01:00
Jakub Roztocil
25b1be7c8a Work around missing object_pairs_hook in Python 2.6 2015-01-23 22:04:42 +01:00
Jakub Roztocil
22c993bab8 Merge branch 'fix-268' of https://github.com/asnelzin/httpie into asnelzin-fix-268 2015-01-23 21:45:09 +01:00
Jakub Roztocil
b2ec4f797f Exit with 0 for --version and --help (closes #293). 2015-01-19 15:39:46 +01:00
Alexander Nelzin
a2b12f75ea Fixed and added test for JSON properties order. 2014-11-13 23:56:05 +03:00
Jakub Roztocil
0481957715 Fixed multiple uploads with the same field name
Closes #267
2014-10-20 14:41:48 +02:00
Jakub Roztocil
c301305a59 Cleanup. 2014-10-20 14:41:48 +02:00
Jakub Roztocil
2078ece95a Cleanup 2014-10-20 14:41:48 +02:00
Dennis Brakhane
f1cd289d51 Fallback to JSON highlighting if subtype contains json
Some JSON based formats like JSON Home Documents[1] don't
use a '+json' suffix, but simply contain json in their
MIME type. Also, some servers might use (outdated)
types like 'application/x-json'.

The JSON formatter can already handle those cases,
but the highlighter was ignoring them.

This commit will let the highlighter choose the JSON
lexer if no other lexer could be found and the MIME subtype
contains 'json'

[1] http://tools.ietf.org/html/draft-nottingham-json-home-03
2014-09-25 00:10:06 +02:00
Jakub Roztocil
58b51a8277 Improved terminal color depth detection via curses
Closes #244
2014-09-08 07:46:53 +02:00
Jakub Roztocil
b0effe07d9 Fixed --output=/dev/null on Linux
Closes #252
2014-09-07 10:22:21 +02:00
Jakub Roztocil
5084f18568 '\' only escapes separator characters in req-items
It makes easier to work with Windows paths.

Closes #253, #254
2014-09-05 18:36:23 +02:00
Jakub Roztocil
1035710956 Added RequestItems named tuple for convenience. 2014-09-05 07:51:35 +02:00
Jakub Roztocil
ca36f1de04 Handle empty passwords in URL credentials
Closes #242
2014-07-18 13:39:47 +02:00
Jakub Roztocil
0f96348fd1 Cleanup 2014-07-18 13:39:47 +02:00
Jakub Roztocil
2a72ae23d5 Run tests against local httpbin instance via pytest-httpbin. 2014-06-28 16:38:41 +02:00
Jakub Roztocil
040d981f00 Fixed custom Host
Closes #235
2014-06-28 13:24:14 +02:00
Jakub Roztocil
8e170b059c Fixed tests. 2014-06-03 19:45:57 +02:00
Jakub Roztocil
e4c68063b9 Converted built-in formatters to formatter plugins.
Still work in progress and the API should be considered private for now.
2014-05-12 19:12:39 +02:00
Jakub Roztocil
858555abb5 Make sure session and default headers play nice
Before: headers = default + args + session
Now:    headers = default + session + args

Fixes #180
2014-05-08 12:27:50 +01:00
Jakub Roztocil
d9eca19b8f New URL. 2014-05-05 21:17:23 +02:00
Jakub Roztocil
faec00fd99 Improve support for 'type/subtype+suffix' mime types in the colors output formatter.
E.g.:
* application/ld+json
* application/hal+json

Closes #189, #206
2014-04-28 10:08:03 +02:00
Jakub Roztocil
0e6875bf83 Handle HTTP 0.9 in response when formatting version.
Closes #170
2014-04-28 00:08:20 +02:00
Jakub Roztocil
bd50a6adb1 Moved .directory from BaseConfigDict to Config.
Closes #200
2014-04-27 23:12:48 +02:00
Jakub Roztocil
05db75bdb1 Modularized output, refactoring
Making it ready for output formatting plugin API.
2014-04-27 21:58:00 +02:00
Jakub Roztocil
c06598a0c4 Cleanup 2014-04-27 18:27:44 +02:00
Jakub Roztocil
87806acc56 Cleanup 2014-04-26 23:06:39 +02:00
Jakub Roztocil
43bc6d0c98 Fixed and added tests for --verbose with unicode headers. 2014-04-26 20:10:15 +02:00
Jakub Roztocil
0bd218eab0 Cleanup 2014-04-26 19:32:08 +02:00
Jakub Roztocil
a3352af1d4 Added support and tests for unicode support in sessions. 2014-04-26 18:16:30 +02:00
Jakub Roztocil
467d126b6c Python 3 unicode fixes. 2014-04-26 17:35:26 +02:00
Jakub Roztocil
282cc455e3 Avoid "TypeError: keyword arguments must be strings" on Python 3.3. 2014-04-26 15:18:38 +02:00
Jakub Roztocil
56d33a8e51 Fix Windows branch. 2014-04-26 15:10:39 +02:00
Jakub Roztocil
15e62ad26d Implemented more robust unicode handling.
* Immediatelly convert all args from `bytes` to `str`.
* Added `Environment.stdin_encoding` and `Environment.stdout_encoding`
* Allow unicode characters in HTTP headers and basic auth credentials
  by encoding them using UTF8 instead of latin1 (#212).
2014-04-26 15:07:31 +02:00
Jakub Roztocil
b10d973019 Removed unused import. 2014-04-25 12:53:02 +02:00
Jakub Roztocil
af4aa3a761 Test improvements. 2014-04-25 12:18:35 +02:00
Jakub Roztocil
f02169ea71 Added Python 2.6 compatible OrderedDict
To preserver ordr of headers, parameters, etc.
2014-04-24 19:57:19 +02:00
Jakub Roztocil
e5d758e4ce More tests. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
bdea7be456 Added tests for --debug and --help. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
3d079942f4 Finished pytest migration. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
6071fff4af Refactored tests into smaller modules. 2014-04-24 14:07:31 +02:00
Jakub Roztočil
733771fd9e Merge pull request #172 from unsignedint/master
process XML data before pretty-printing to trim whitespace
2014-03-18 19:44:16 +01:00
Jakub Roztocil
29877bc8ad Updated installation instructions. 2014-03-04 18:24:32 +01:00
Jakub Roztocil
b01906a45c Fixed ZeroDivisionError in download summary.
Closes #202
2014-02-18 13:06:18 +01:00