Commit Graph

644 Commits

Author SHA1 Message Date
Jakub Roztocil
d35864e79d Cleanup 2020-06-16 13:01:48 +02:00
Jakub Roztocil
8a106781be Add --sorted
Also add --no-(sorted|unsorted) to allow the documented resetting to default via --no-<option>.
2020-06-16 12:54:50 +02:00
Jakub Roztocil
23dd80563f Cleanup 2020-06-16 12:25:46 +02:00
Jakub Roztocil
2bab69d9fb Fix default value 2020-06-16 12:24:03 +02:00
Jakub Roztocil
826489950d Added --unsorted
It acts as a shortcut for --format-options=json.sort_keys:false,headers.sort:false

#128
2020-06-16 12:20:13 +02:00
Jakub Roztocil
b86598886e Added netrc support for auth plugins.
Enabled for --auth-type=basic and digest, 3rd parties may opt in.

This closes #718, closes #719, closes #852, and also closes #934
2020-06-16 11:05:00 +02:00
Jakub Roztocil
37200eb055 Cleanup 2020-06-15 23:02:16 +02:00
Eyitayo Ogunbiyi
9c68d7dd87
Remove expired cookies (#929)
* added a test for expiring cookies

* updated tests

* set up util for extracting expired cookies from response header

* Revert "updated tests"

This reverts commit a4eb5c4498.

* Revert "Revert "updated tests""

This reverts commit d242e21bce.

* added more functionality to get-expired-cookies

* add 'clear expired cookies' from session.json files

* refactored get_expired_cookies

* fixed formatting issues

* ensured key exists in cookie_header dict

* fixed linting errors

* removed unused import

* Added tests for get_expired_cookies util

* Added additional test for get_expired_cookies

* added remove_expired_cookies method directly to sessions class

* extracted logic to clear cookies to sessions.py

* refactored utils

* added tests to check expired cookies being removed from session obj

* added type annotations for methods

* Refactored test_sessions

* Seperated out expiry related tests into own class

* Refactored get_expired_cookies in utils

* Refactored remove cookie methods

* fixed linting errors

* fixed indentation and also pluralized test class name

* removed inheritance from SessionTestbase class

* Moved related test to TestExpiredCookies class

Co-authored-by: kbanc <katherine.bancoft@gmail.com>
2020-06-15 22:28:04 +02:00
Jakub Roztocil
7ee519ef46 Update CHANGELOG 2020-06-08 18:02:04 +02:00
Carlo Sciolla
c4627cc882
Custom file upload MIME type (#927)
* Support curl-like syntax for custom MIME type for files

In order to specify a custom MIME type for file uploads, a syntax
similar to that used by cURL is used so that

http -F test_file@/path/to/file.bin;type=application/zip https://...

forwards the user-provided file type if provided, otherwise falling
back to the usual guesswork out of the file extension.
2020-06-08 17:59:41 +02:00
Jakub Roztocil
caeef2fb7c Use : instead of = in `--format-options 2020-05-28 14:24:15 +02:00
Jakub Roztocil
aae596d472 Improve --format-options error messages 2020-05-27 16:19:32 +02:00
Jakub Roztocil
cb51faec51 pep8 2020-05-27 16:12:31 +02:00
Jakub Roztocil
c2a0cef76e Add --format-options to allow disabling sorting, etc.
#128
2020-05-27 16:01:17 +02:00
Jakub Roztocil
ca02e51420 Improve plugin API docs 2020-05-26 10:07:53 +02:00
Jakub Roztocil
cd085cbc0d Refactor built-in plugin registry to avoid circular imports
Fix #925
2020-05-26 10:07:34 +02:00
Jakub Roztocil
27d57ce773 Cleanup 2020-05-23 20:30:25 +02:00
Jakub Roztocil
4c4efff56a Pass cert_reqs to context 2020-05-23 20:19:16 +02:00
Jakub Roztocil
a53505f26e Fix SSL context 2020-05-23 15:01:33 +02:00
Jakub Roztocil
d62d6a77d1 Add support for --ciphers (#870) 2020-05-23 13:26:06 +02:00
Jakub Roztocil
3e20ade645 Cleanup & refactor XDG_CONFIG_HOME support 2020-05-23 12:12:35 +02:00
Ash Holland
5af0874ed3
Support (part of) the XDG Base Directory Specification (#920)
On Unix-like systems, the configuration file now lives in
$XDG_CONFIG_HOME/httpie/ by default, not ~/.httpie/ (the behaviour on
Windows is unchanged). The previous location is still checked, in order
to support existing installations.

Searching $XDG_CONFIG_DIRS is still not supported.

Fixes #145; supersedes #436.
2020-05-21 15:50:00 +02:00
Jakub Roztocil
774ff148cd 2.2.0-dev 2020-04-18 12:57:56 +02:00
Jakub Roztocil
70a78249c1 2.1.0
#488 #840 #895
2020-04-18 12:54:40 +02:00
Jakub Roztocil
4351650691 Ignore --download with --offline 2020-04-16 11:41:12 +02:00
Jakub Roztocil
c9d770017e Fix 'Too many redirects' error message formatting 2020-04-15 17:43:08 +02:00
Jakub Roztocil
cdf691c212
Change default JSON Accept to application/json, */*;q=0.5
Close #488
2020-04-13 22:12:06 +02:00
Jakub Roztocil
684a4708d7 Add --path-as-is
Close #895
2020-04-13 20:18:56 +02:00
Mio
5754e33a75
Removed duplicate type annotation. (#888) 2020-04-13 18:15:48 +02:00
Jakub Roztocil
3a6ac7d126 Remove unused imports 2020-04-13 17:37:27 +02:00
Jakub Roztocil
381dd4f619 Actually fixed --form file upload w/ redirected stdin error handling
#840
2020-01-23 15:56:29 +01:00
Jakub Roztocil
e6bad645ed Fixed --form file upload mixed with redirected stdin error handling.
Close #840
2020-01-23 15:55:00 +01:00
Jakub Roztocil
4b524e6a8c v2.0.0 2020-01-12 10:50:57 +01:00
Jakub Roztocil
585cc0c039 Merge remote-tracking branch 'origin/master' 2019-12-04 13:37:46 +01:00
Tim Gates
89faec994a Fix simple typo: downland -> download (#823)
Closes #822
2019-12-04 13:32:08 +01:00
Jakub Roztocil
490eeaa650 Cleanup 2019-12-03 19:09:09 +01:00
Jakub Roztocil
f202f338a4 Remove automatic config file creation to avoid concurrency issues.
Close #788
Close #812
2019-12-02 17:43:16 +01:00
Jakub Roztocil
f0058eeaee cleanup 2019-12-02 10:42:33 +01:00
Jakub Roztocil
a23b636a63 Cleanup 2019-12-02 00:58:10 +01:00
Jakub Roztocil
d9b3a16fa6 Make ExitStatus subclass IntEnum to allow direct int comparisons 2019-09-18 11:57:06 +02:00
Jakub Roztocil
a42b275ae2 Typing & cleanup 2019-09-17 09:21:49 +02:00
Jakub Roztocil
37fa67cd3c Runnable KeyValueArgType.tokenize doctest 2019-09-17 09:07:12 +02:00
Jakub Roztocil
374c371ef1 Add httpie.status 2019-09-16 13:26:18 +02:00
Jakub Roztocil
c8fd4c2d6e Move compression out of adapter 2019-09-04 00:00:03 +02:00
Jakub Roztocil
bece3c77bb Add one-by-one processing of each HTTP request or response and --offline 2019-09-03 17:14:39 +02:00
Jakub Roztocil
c946b3d34f Cleanup 2019-09-02 14:38:23 +02:00
Jakub Roztocil
45e8e4e4ea Sessions 2019-09-01 21:15:39 +02:00
Jakub Roztocil
bd3208cf24 Refactor get_formatters_grouped 2019-09-01 11:45:47 +02:00
Jakub Roztocil
4dffac7a25 Refactor client 2019-09-01 11:38:14 +02:00
Jakub Roztocil
a34b3d9d87 Refactor PluginManager 2019-09-01 11:13:45 +02:00
Jakub Roztocil
30624e66ec Annotate formatters and processing 2019-08-31 19:13:36 +02:00
Jakub Roztocil
d603502960 Fix unregister annotation 2019-08-31 18:35:24 +02:00
Jakub Roztocil
b947d4826a Annotate plugins 2019-08-31 18:33:54 +02:00
Jakub Roztocil
e8ef5a783f Annotate and refactor streams.py 2019-08-31 18:21:10 +02:00
Jakub Roztocil
9da5c41704 Improve --debug output formatting 2019-08-31 18:00:03 +02:00
Jakub Roztocil
224519e0e2 Fix --ssl with --compress; refactor client 2019-08-31 17:52:56 +02:00
Jakub Roztocil
aba3b1ec01 Refactoring 2019-08-31 15:17:10 +02:00
Jakub Roztocil
3ea75a3577 Document $ALL_PROXY support (close #676)
It’s been supported by python-requests since v2.11.0 (2016-08-08)

d79024f246/HISTORY.md (2110-2016-08-08)
2019-08-31 12:31:32 +02:00
Jakub Roztocil
1dc67a6a38 Allow bypassing .netrc with --ignore-netrc (close #730) 2019-08-31 12:09:17 +02:00
Jakub Roztocil
a5713f7190 pep8 2019-08-30 21:26:51 +02:00
Jakub Roztocil
0f654388fc Python 3 annotations, super(), pathlib, etc. 2019-08-30 15:14:51 +02:00
Jakub Roztocil
63df735fef Update links to HTTPS 2019-08-30 10:07:01 +02:00
Jakub Roztocil
2579827418 Use set literal 2019-08-30 09:56:50 +02:00
Jakub Roztocil
9bd8b4e8f7 Don't fail if config dir not writeable (close #738) 2019-08-29 14:05:32 +02:00
Jakub Roztocil
ced9212c1f Allow stdin to be a closed fd #791 2019-08-29 13:39:42 +02:00
Jakub Roztocil
07da8ea852 Merge branch 'allow-closed-stdin' of https://github.com/mgsloan/httpie into mgsloan-allow-closed-stdin 2019-08-29 13:26:28 +02:00
Jakub Roztocil
8e04a24b90 Reintroduce $ https command alias with https:// as default scheme
Close #608
2019-08-29 13:08:02 +02:00
Jakub Roztocil
a4d8f1f22e Refactor --compress tests 2019-08-29 11:46:08 +02:00
Aleksandr Vinokurov
5ec954c03d Add compressed requests (#739)
* Add optional compression of the request's content

This option allows compression of the files and/or data during uploading,

Examples:

    http --form --compress POST https://localhost/upload csv@./very-big.csv

    http -x -x POST https://localhost/upload foo=bar

    cat /var/log/system.log | http -x POST https://localhost/upload

Signed-off-by: Aleksandr Vinokurov <aleksandr.vin@gmail.com>

* Add tests for compression

Signed-off-by: Aleksandr Vinokurov <aleksandr.vin@gmail.com>

* Fix code style issues

Signed-off-by: Aleksandr Vinokurov <aleksandr.vin@gmail.com>

* Fix zlib compression api missuse in Python3

Signed-off-by: Aleksandr Vinokurov <aleksandr.vin@gmail.com>

* Remove tracing from compression logic

Signed-off-by: Aleksandr Vinokurov <aleksandr.vin@gmail.com>
2019-08-29 10:44:59 +02:00
Jakub Roztocil
bb4f101c1e pep8 2019-08-29 10:09:56 +02:00
Jakub Roztocil
82081c889b Fix `--timeout=0` 2019-08-29 10:06:25 +02:00
Jakub Roztocil
05fc9c480a Remove the default 30-second connection timeout limit 2019-08-29 09:57:00 +02:00
Jakub Roztocil
a969013bdd Disable default max headers limit and add --max-headers (closes #802) 2019-08-29 09:39:19 +02:00
Jakub Roztocil
b3d2c1876e Python 2.7 support removal WIP 2019-08-29 08:53:56 +02:00
Jakub Roztocil
747be30d2e 1.0.3 2019-08-26 12:42:34 +02:00
Michael Sloan
c5ca9d248e Allow stdin to be a closed fd
Before this change, the following invocation would not work

```
$ http http://neverhttps.com <&-
```

The "<&-" at the end closes the stdin fd. Specifically, it would fail with

```
  ...
  File "/home/mgsloan/.local/lib/python3.6/site-packages/httpie/context.py", line 26, in Environment
    stdin_isatty = stdin.isatty()
AttributeError: 'NoneType' object has no attribute 'isatty'
```

This can occur when httpie is being programmatically invoked, and may
as well be supported.
2019-07-17 23:02:49 -06:00
Jakub Roztocil
6dee49357d Fix comments 2019-06-24 12:29:42 +02:00
Jakub Roztocil
df36d6255d Changed the way the output filename is generated
When ``--download`` without ``--output`` results in a redirect,
now only the initial URL is considered, not the final one.
2019-06-24 12:20:09 +02:00
Mickaël Schoentgen
3a46149de1 Fix several ResourceWarning: unclosed file (#741)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-02-04 10:00:30 +01:00
Jakub Roztocil
c591a3810d 1.0.3-dev 2018-11-14 16:36:47 +01:00
Jakub Roztocil
0eba037037 v1.0.2
Close #729
2018-11-14 16:36:19 +01:00
Jakub Roztocil
3898129e9c Changelog 2018-11-14 16:22:00 +01:00
Jakub Roztocil
f6a19cf552 Don't call external URLs from tests #729 2018-11-14 11:42:59 +01:00
Jakub Roztocil
b5625e3d75 v1.0.0 2018-11-02 16:24:35 +01:00
Jakub Roztocil
932d3224f4 Cleanup 2018-11-02 16:23:17 +01:00
Jakub Roztocil
b596fedf13 exit 0 constant: OK => SUCCESS to avoid confusion w/ HTTP 200 OK 2018-11-02 16:07:39 +01:00
Jakub Roztocil
89b66f1608 Merge remote-tracking branch 'origin/master' 2018-11-02 14:58:08 +01:00
Vladimir Berkutov
a7d570916d #722: Add support for tls1.3 (#724)
* #722: Add support for tls1.3

* #722: Document the potential support for tls1.3
2018-11-02 14:57:53 +01:00
Jakub Roztocil
ab5a50cee8 Finish --style=auto for terminal ANSI colors and make it the default.
Previously (only in the development version), this was called 'preset'.
2018-11-02 14:53:05 +01:00
Matúš Ferech
256ea7d49d Add prog parameter to HTTPieArgumentParser (#715) 2018-10-30 18:41:56 +01:00
Matthew Leather
2cd6ea3050 Fix some broken documentation links (#703) 2018-09-07 19:10:04 +02:00
Jakub Roztocil
7917f1b40c Build fixes and clean-up
* reflect Python 3.7 release
* fix `pycodestyle` errors
* update `pycodestyle` config
* move `pytest` and `pycodestyle` config to `setup.cfg`
* add `make pycodestyle`
* add `make coveralls`
* etc.
2018-07-12 21:16:16 +02:00
Piotr Śliwka
87e661c5f1 Support using styles from Pygments plugins (#663)
`pygments.styles.STYLE_MAP` contains only styles built directly into
Pygments library. To list all available styles (including styles
registered by plugins), one should use `get_all_styles` generator.

For respective Pygments documentation, see:
http://pygments.org/docs/styles/#getting-a-list-of-available-styles
2018-04-14 15:25:59 -05:00
Jakub Roztocil
0f4dce98c7 Make default HTTP headers case-insensitive
Cloase #644
2018-02-22 12:52:57 +01:00
Jakub Roztocil
a803e845a5 More robust urllib3 import 2017-12-28 18:32:12 +01:00
Jakub Roztocil
7f5fd130c5 Start using dict comprehensions 2017-12-28 18:15:17 +01:00
Jakub Roztocil
ec899d70b7 Removed Python 2.6 support
* Travis CI doesn't support it anymore.
* It had EOL more than 4 years ago
2017-12-28 18:03:37 +01:00
Jakub Roztocil
4c138959ea
Merge pull request #633 from darshanime/version_number_fix
fix env version attribute
2017-12-13 21:18:38 +01:00
darshanime
6472ca55e1 fix env version attribute 2017-11-18 19:01:26 +05:30
James
0aab796960
Clarify error message 2017-11-13 07:23:52 -05:00
Jakub Roztocil
f1d4861fae Merge pull request #568 from dsego/dsego/ansi-colors
Follow terminal ANSI color styles

Close #524
2017-03-12 22:44:05 +01:00
Davorin Šego
02209c2db1 Oops, remove semicolons 2017-03-11 18:12:00 +01:00
Davorin Šego
9886f01f91 New style option that applies the terminal ANSI color scheme 2017-03-11 18:00:35 +01:00
Davorin Šego
a4f796fe69 Revert "Follow terminal ANSI color styles"
This reverts commit b0fde07cfd.
2017-03-11 16:58:50 +01:00
Jakub Roztocil
c948f98b05 Update links 2017-03-10 11:27:38 +01:00
Davorin Šego
b0fde07cfd Follow terminal ANSI color styles
Removes the default solarized color scheme and custom http lexer class.
2017-03-06 01:05:50 +01:00
Jakub Roztocil
7321b9fa4e Add --verify true/false tests and CHANGELOG 2017-02-17 00:56:07 +01:00
Michael Floering
64af72eb88 Turn --verify=False/True to --verify=no/yes
One way to address #559 -- https://github.com/jkbrzt/httpie/issues/559
-- instead of warning or throwing an error, just accept "True" and "False"
as synonyms of yes/no

(Updated to reflect feedback given at https://github.com/jkbrzt/httpie/pull/560 )
2017-02-13 18:30:55 -06:00
Jakub Roztocil
586f45e634 Merge pull request #494 from keik/patch-1
Fix typo
2017-02-07 20:50:43 +01:00
Jakub Roztocil
0af6ae1be4 Fix PyPi README rendering
Close #540
2016-12-09 00:26:55 +01:00
Jakub Roztocil
3a3aecca45 0.9.8 2016-12-08 05:22:20 +01:00
Jakub Roztocil
fb3a26586a Fix --auth-type help 2016-12-08 05:16:22 +01:00
Jakub Roztocil
3a6fd074a1 Added ExitStatus.PLUGIN_ERROR (7) 2016-12-08 04:42:17 +01:00
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