Compare commits

...

5074 Commits

Author SHA1 Message Date
Cory Benfield
a3d7cf3f27 v2.18.4 2017-08-15 14:22:52 +01:00
Cory Benfield
3c5ecfc9f5 Merge pull request #4240 from mgasvoda/master
Adding header name to exception
2017-08-12 15:41:27 +01:00
mgasvoda
d528106876 Adding record to history 2017-08-12 10:23:45 -04:00
mgasvoda
cbc7c2d1c9 Modifying tests to include header name info 2017-08-11 17:18:58 -04:00
mgasvoda
e36083b89c Adding space after colon 2017-08-11 16:19:43 -04:00
mgasvoda
308343508b Removing trailing whitespace 2017-08-11 16:14:13 -04:00
mgasvoda
ba21d14976 Improving message formatting 2017-08-11 16:12:36 -04:00
mgasvoda
cee8fae65e Adding header name to exception
Adds the name of the header to the invalid header exception raised on TypeError.
2017-08-11 15:37:57 -04:00
Kenneth Reitz
1c2022cf86 Merge pull request #4231 from Lukasa/drop-3.3-support
Drop Python 3.3 support.
2017-08-10 14:03:36 -04:00
Kenneth Reitz
8480cf937a Merge pull request #4237 from robinske/doc-import
Adds import statement to front page of docs for clarity and quicker start up
2017-08-10 14:02:57 -04:00
Kelley Robinson
f6952a9b8d Merge branch 'master' into doc-import 2017-08-10 10:33:22 -07:00
kelley
d758f0cf97 Adds import statement to front page of docs for clarity and quicker start up 2017-08-10 10:23:43 -07:00
Cory Benfield
c31a450c55 Remove references to 3.3 from the docs 2017-08-09 19:40:52 +01:00
Cory Benfield
0a2dc74ecb Drop Python 3.3 support 2017-08-09 19:03:04 +01:00
Cory Benfield
f78a57936b Merge pull request #4229 from NikosVlagoidis/issue#3863
Fixes issue #3863
2017-08-09 18:56:40 +01:00
NikosVlagoidis
218978601f Fix issue #3863 2017-08-09 20:18:43 +03:00
NikosVlagoidis
cb9620780f Update advanced.rst 2017-08-09 18:52:26 +03:00
Nikolaos Vlagoidis
963c78853f Fixes issue #3863 2017-08-09 15:38:45 +03:00
Kenneth Reitz
b670b61d54 Update AUTHORS.rst 2017-08-08 19:16:39 -04:00
Cory Benfield
9ec2005d9f Merge pull request #4223 from Lukasa/widen-idna-pin
Allow IDNA 2.6
2017-08-08 15:42:54 +01:00
Cory Benfield
f4ddf00c36 Allow IDNA 2.6 2017-08-08 13:32:15 +01:00
Cory Benfield
248f122970 Merge pull request #4217 from nikolas/patch-1
fix typo in changelog
2017-08-02 15:38:46 +01:00
Nik Nyby
be8ce365ab fix typo in changelog 2017-08-02 10:26:41 -04:00
Cory Benfield
3393dc8221 Prepare changelog for next release 2017-08-02 14:24:02 +01:00
Cory Benfield
7c67c4adf9 v2.18.3 2017-08-02 14:22:44 +01:00
Ian Stapleton Cordasco
2a4dd64fb4 Merge pull request #4210 from Lukasa/sslerror
Make sure we raise SSLError.
2017-07-29 06:27:17 -05:00
Cory Benfield
9e0fb37fff Changelog for #4209 2017-07-29 12:13:55 +01:00
Cory Benfield
4f49f6b3ed Correctly raise SSLError from urllib3. 2017-07-29 12:12:11 +01:00
Cory Benfield
8b3f20ca91 Add failing test for #4209 2017-07-29 12:09:04 +01:00
Nate Prewitt
fdf426125b Merge pull request #4182 from alexwlchan/idna-version
Add idna version info to requests.help
2017-07-27 14:54:09 -06:00
Alex Chan
d6b57c6fb2 Changelog entry 2017-07-27 21:33:44 +01:00
Alex Chan
39b121d791 Add idna version info to requests.help 2017-07-27 21:33:42 +01:00
Nate Prewitt
12c7456789 Merge pull request #4174 from alex/patch-2
Removed legacy fallback for python3.2
2017-07-27 09:51:33 -06:00
Alex Gaynor
2629c0906e Merge branch 'master' into patch-2 2017-07-27 11:19:32 -04:00
Cory Benfield
205755834d Merge pull request #4207 from markjszy/master
remove legacy super() call
2017-07-27 05:40:03 +01:00
Mark Szymanski
e2f5a135c3 remove legacy super() call 2017-07-26 19:21:45 -05:00
Cory Benfield
8de858f0de Merge pull request #4206 from jvanasco/feature-redirects
some docs on request redirect detection
2017-07-26 20:57:22 +01:00
jonathan vanasco
667896c557 some docs on request redirect detection 2017-07-26 15:32:07 -04:00
Cory Benfield
2b6f1e6236 Merge pull request #4204 from browniebroke/patch-1
Correct urllib3 compatibility comment
2017-07-26 11:03:57 +01:00
Bruno Alla
b77c1a3deb Correct urllib3 compatibility comment
So that it's in line with the code. I saw the warning raised recently and had to dive into the code for exact compatibility, but I stopped after reading the comment rather than the code. 
Maybe a better solution would be to surface the supported versions in the warning, but I see it was changed recently in https://github.com/requests/requests/pull/4144/
2017-07-26 10:23:01 +01:00
Cory Benfield
9e8d403a21 Prepare changelog for next release 2017-07-25 16:23:50 +01:00
Cory Benfield
6cc891fd32 v2.18.2 2017-07-25 16:21:48 +01:00
Cory Benfield
49c44a0c08 Merge pull request #4198 from andportnoy/patch-1
redundant comma
2017-07-21 07:05:10 +01:00
Andrey Portnoy
c6e18b04e3 redundant comma 2017-07-20 20:49:24 -07:00
Ian Stapleton Cordasco
c10b8384e4 Merge pull request #4196 from Lukasa/require-next-urllib3
Allow urllib3 1.22
2017-07-20 06:52:11 -05:00
Cory Benfield
8d1228cd19 Allow urllib3 1.22 2017-07-20 10:08:50 +01:00
Cory Benfield
8e227aeb89 Merge pull request #4195 from requests/requests/sessions-mount-docstring-clarity
Use 'prefix' instead of 'key' in session docstring
2017-07-20 09:13:06 +01:00
Alex Muller
d8c2fdf92f Use 'prefix' instead of 'key' in session docstring
This commit makes the API docs more clear. The 'key' is an
implementation detail.
2017-07-20 10:06:34 +02:00
Cory Benfield
cada19b300 Merge pull request #4192 from koobs/patch-2
Add requirements.txt to MANIFEST.in
2017-07-15 07:39:01 +01:00
Kubilay Kocak
c6a80640d1 Add requirements.txt to MANIFEST.in 2017-07-15 14:44:57 +10:00
Kenneth Reitz
649efc8c9b Merge branch 'master' of github.com:kennethreitz/requests 2017-07-06 17:57:37 -04:00
Kenneth Reitz
14176d1d63 no more stickers 2017-07-06 17:57:28 -04:00
Cory Benfield
1ea4e21958 Merge pull request #4183 from requests/fix_help_ssl_check
Fix help ssl check
2017-07-04 09:16:02 +01:00
Nate Prewitt
51feabbc27 test ssl version check functions as expected in python 2.6 2017-07-04 00:33:16 -06:00
Nate Prewitt
f6e07bb27f fix OPENSSL_VERSION_NUMBER check on Python2.6's ssl module 2017-07-03 17:21:56 -06:00
Alex Gaynor
c054a722bb Removed legacy fallback for python3.2 2017-06-25 12:51:15 -04:00
Kenneth Reitz
bbeb1c32d2 Merge branch 'master' of github.com:kennethreitz/requests 2017-06-16 18:31:19 -04:00
Kenneth Reitz
1263b8660d stickers 2017-06-16 18:30:39 -04:00
Cory Benfield
2fde9ee407 Setup HISTORY for next release 2017-06-14 18:52:03 +01:00
Cory Benfield
51de61f914 v2.18.1 2017-06-14 18:50:53 +01:00
Cory Benfield
dd13b13479 Prepare for next release cycle 2017-06-14 16:45:03 +01:00
Cory Benfield
d93b37cee7 Prepare v2.18.0 2017-06-14 16:43:40 +01:00
Kenneth Reitz
a5b8f8d40a Merge branch 'master' of github.com:kennethreitz/requests 2017-06-11 18:10:11 -04:00
Kenneth Reitz
a8972a5bd2 attempt new ads 2017-06-11 18:10:05 -04:00
Cory Benfield
bb4326c676 Merge pull request #4152 from felixonmars/patch-1
Fix a typo: paramters -> parameters
2017-06-11 18:34:36 +01:00
Felix Yan
a0f0258eee Fix a typo: paramters -> parameters 2017-06-12 01:27:11 +08:00
Cory Benfield
c5901ac893 Merge pull request #4151 from mayhewj/remove-exec
Remove exec permission from files that shouldn't have it
2017-06-11 10:26:51 +01:00
Justin Mayhew
c6a6347156 Remove exec permission from files that shouldn't have it 2017-06-10 20:38:45 -03:00
Cory Benfield
132040cc03 Merge pull request #4134 from mlcrazy/master
Raise exceptions in utils.set_environ
2017-06-09 19:34:56 +01:00
mlcrazy
613f61d77c Merge remote-tracking branch 'upstream/master' 2017-06-09 14:32:27 -04:00
mlcrazy
edcc894a2e Adds to AUTHORS 2017-06-09 14:29:28 -04:00
mlcrazy
761e39b443 Adds changelog entry for #4134 2017-06-09 14:16:32 -04:00
mlcrazy
1d7fd6c8b3 Fixes error swallowing in set_environ 2017-06-09 14:10:47 -04:00
Kenneth Reitz
b3d138e0fd Merge pull request #4140 from Lukasa/issue/4138
Clearer makefile for building README.
2017-06-09 13:30:56 -04:00
Kenneth Reitz
8a8b71f786 Merge branch 'master' into issue/4138 2017-06-09 13:27:02 -04:00
Cory Benfield
2872f17ab8 Merge pull request #4145 from gaojiuli/patch-1
typo
2017-06-09 10:04:40 +01:00
JiuLi Gao
22d12b0501 typo 2017-06-09 16:56:14 +08:00
Nate Prewitt
13eb907c48 Merge pull request #4144 from nateprewitt/move_compat_to_warn
Convert version compatibility checks to warnings
2017-06-08 19:40:07 -06:00
Nate Prewitt
d8e2367809 convert version compatibility checks to warning 2017-06-08 15:21:25 -06:00
Cory Benfield
f8ccc60498 Clearer makefile for building README 2017-06-07 13:50:00 +01:00
Cory Benfield
4f1b17c9c1 Merge pull request #4137 from edmorley/response-context-manager
Allow Requests.Response to be used as a context manager
2017-06-07 08:51:41 +01:00
Ed Morley
4847f5b8cd Allow Requests.Response to be used as a context manager
This saves having to wrap the call to requests with
`contextlib.closing()`, allowing it to be used directly in a
`with` statement, like so:

```
with requests.get('http://httpbin.org/get', stream=True) as r:
    # Do things with the response here.
```

Fixes #4136.
2017-06-06 23:30:47 +01:00
Kenneth Reitz
40ce8144d1 Merge pull request #4135 from edmorley/gitignore-pytest-cache
Add the pytest .cache/ directory to .gitignore
2017-06-06 18:00:38 -04:00
Ed Morley
5a616ee980 Add the pytest .cache/ directory to .gitignore
For example, when a pytest run fails, it saves failure metadata to:
`.cache/v/cache/lastfailed`
2017-06-06 22:44:22 +01:00
Nate Prewitt
b6ee4b2156 Merge pull request #4129 from felixonmars/fix-typo
Fix a typo: verison -> version
2017-06-05 22:07:28 -06:00
Felix Yan
0abb69b1cb Fix a typo: verison -> version 2017-06-06 12:01:41 +08:00
Cory Benfield
56971482af Merge pull request #4114 from cyberjacob/master
Catch error if multiprocessing is not available or is unable to determine the number of CPUs
2017-05-30 13:54:31 +01:00
Jacob Mansfield
98bbf8d170 Catch error if multiprocessing is not available or is unable to determine the number of CPUs 2017-05-30 13:47:55 +01:00
Cory Benfield
d3a4d06238 Begin dev section of README 2017-05-30 11:49:05 +01:00
Kenneth Reitz
152faa2a0f change development philosophy docs to reflect reality 2017-05-29 23:46:50 -04:00
Kenneth Reitz
e41c2c2d96 remove note about cacerts.pem 2017-05-29 23:43:53 -04:00
Kenneth Reitz
3ca2722802 improve development instructions 2017-05-29 23:41:48 -04:00
Kenneth Reitz
310d7f8a9b update development documentation 2017-05-29 23:40:44 -04:00
Kenneth Reitz
01f982da50 remove "are you crazy?" section 2017-05-29 23:38:48 -04:00
Kenneth Reitz
ba509635a3 fix sidebars 2017-05-29 23:36:50 -04:00
Kenneth Reitz
008ab18a77 improve installation docs 2017-05-29 23:33:51 -04:00
Kenneth Reitz
67831abaaf improve install docs 2017-05-29 23:33:25 -04:00
Kenneth Reitz
0f57faba70 fix github stars 2017-05-29 23:26:50 -04:00
Kenneth Reitz
35f2e55308 improve installation instructions 2017-05-29 23:26:15 -04:00
Kenneth Reitz
77ae596e8b Merge branch 'master' of github.com:kennethreitz/requests 2017-05-29 23:25:31 -04:00
Kenneth Reitz
84114419a0 improve install documentation syntax 2017-05-29 23:25:21 -04:00
Kenneth Reitz
500fe3ee03 Merge pull request #4108 from requests/flake8-improvements
flake8 improvements
2017-05-29 23:08:03 -04:00
Kenneth Reitz
d78ec90e7b cleanup utils.py 2017-05-29 23:04:45 -04:00
Kenneth Reitz
04ed1e5122 cleanup sessions.py 2017-05-29 23:02:23 -04:00
Kenneth Reitz
33619268f9 cleanup models.py 2017-05-29 23:00:09 -04:00
Kenneth Reitz
e5894e99b7 improve flake8 help.py 2017-05-29 22:58:01 -04:00
Kenneth Reitz
6495190b00 cleanup help.py (flake8) 2017-05-29 22:55:08 -04:00
Kenneth Reitz
5b363d1a57 improve line continuations for flake8 2017-05-29 22:54:23 -04:00
Kenneth Reitz
f6a4ab02da fix empty lines for flake8 2017-05-29 22:44:33 -04:00
Kenneth Reitz
5fa4e74d61 fix flake8 indent error 2017-05-29 22:43:12 -04:00
Kenneth Reitz
7fc48b099e ignore undefined names in flake8 2017-05-29 22:41:51 -04:00
Kenneth Reitz
3fa02a1336 flake8 ignore lambda expressions 2017-05-29 22:41:07 -04:00
Kenneth Reitz
e55d3d0658 fix spaces in api.py 2017-05-29 22:40:37 -04:00
Kenneth Reitz
7c3861a322 fix flake8 for EOF in __init__.py 2017-05-29 22:40:09 -04:00
Kenneth Reitz
7c2618eb82 flake8: import statement improvements 2017-05-29 22:37:43 -04:00
Kenneth Reitz
4e1bbe1288 ignore line continuations for flake8 2017-05-29 22:35:33 -04:00
Kenneth Reitz
cfc3db06cf ignore import statements for flake8 2017-05-29 22:34:32 -04:00
Kenneth Reitz
5091c15bd7 v2.17.3 2017-05-29 17:54:15 -04:00
Kenneth Reitz
dcb8277975 v2.17.2 2017-05-29 17:52:03 -04:00
Kenneth Reitz
412e3a20a9 2.17.1 2017-05-29 17:52:03 -04:00
Kenneth Reitz
17084cd6d8 Merge pull request #4106 from silverlogic/master
Fix requests.packages not having package attributes
2017-05-29 17:31:49 -04:00
Ryan Pineo
1278ecdf71 Fix requests.packages not having package attributes
Fixes #4104
2017-05-29 17:27:10 -04:00
Kenneth Reitz
2d763c90ae v2.17.1 2017-05-29 15:59:00 -04:00
Kenneth Reitz
db076c098e Merge pull request #4103 from untitaker/issue4102
Preserve identity of unbundled deps
2017-05-29 15:45:39 -04:00
Markus Unterwaditzer
588e8f7f64 Preserve identity of unbundled deps
Fix #4102
2017-05-29 21:41:59 +02:00
Kenneth Reitz
593cd18202 Merge branch 'master' of github.com:kennethreitz/requests 2017-05-29 14:28:23 -04:00
Kenneth Reitz
2daf1cbad9 fix manifest file 2017-05-29 14:28:17 -04:00
Kenneth Reitz
71d8f289b0 Update index.rst 2017-05-29 13:28:54 -04:00
Kenneth Reitz
44c9b7e93b Update README.rst 2017-05-29 13:28:18 -04:00
Kenneth Reitz
916d171f2b Merge branch 'master' of github.com:kennethreitz/requests 2017-05-29 13:17:57 -04:00
Kenneth Reitz
3857431159 v2.17.0 2017-05-29 13:17:49 -04:00
Kenneth Reitz
4ad4670583 Merge pull request #4099 from requests/requests-namespace
Requests namespace
2017-05-29 13:15:20 -04:00
Kenneth Reitz
68076a7f81 Merge pull request #4100 from bcongdon/remove-redirect-cache
Remove session redirect cache
2017-05-29 13:14:42 -04:00
Benjamin Congdon
86f8cb8a35 Remove session redirect cache 2017-05-29 09:53:24 -07:00
Kenneth Reitz
7f14db17c8 new requests namespace 2017-05-29 12:11:43 -04:00
Kenneth Reitz
14c1102e0f new installation location 2017-05-29 12:08:28 -04:00
Kenneth Reitz
c77911ca0f Merge pull request #4094 from kennethreitz/flake8
Flake8
2017-05-29 01:53:26 -04:00
Kenneth Reitz
5a2e5af3a4 try junit 2017-05-29 01:51:06 -04:00
Kenneth Reitz
31fc69ec0d empty commit 2017-05-29 01:39:42 -04:00
Kenneth Reitz
88b435e7e8 only flake8 the right directory 2017-05-29 01:36:00 -04:00
Kenneth Reitz
60226cc25c empty commit 2017-05-29 01:32:26 -04:00
Kenneth Reitz
8ddba4662d no piping to a file 2017-05-28 22:06:04 -04:00
Kenneth Reitz
cd2beaf04a flake8report.txt 2017-05-28 21:54:13 -04:00
Kenneth Reitz
58501d1ec7 docutils 2017-05-28 21:43:29 -04:00
Kenneth Reitz
beccd21146 bunk change 2017-05-28 21:42:09 -04:00
Kenneth Reitz
0622b5c54e flake8 2017-05-28 21:38:27 -04:00
Kenneth Reitz
821774cf47 Update requirements.txt 2017-05-28 21:29:35 -04:00
Kenneth Reitz
78349914c8 Merge pull request #4086 from kennethreitz/travis2
try this travis file
2017-05-28 11:38:51 -07:00
Kenneth Reitz
2ccecf6dbd skip for now 2017-05-28 13:05:09 -04:00
Kenneth Reitz
8af1d9331f fix 2017-05-28 13:03:26 -04:00
Kenneth Reitz
ef34a85378 better ci file 2017-05-28 12:55:59 -04:00
Kenneth Reitz
55014bcc48 try this travis file 2017-05-28 12:51:27 -04:00
Kenneth Reitz
303eca03f3 no more pipenv 2017-05-28 12:37:34 -04:00
Kenneth Reitz
e02eb69fcc that doesn't work on windows 2017-05-28 12:33:56 -04:00
Kenneth Reitz
2936a77678 speed up appveyor 2017-05-28 12:30:58 -04:00
Kenneth Reitz
e6e3589c36 number of cores for travis 2017-05-28 12:14:27 -04:00
Kenneth Reitz
c3a00771e3 todo 2017-05-28 00:43:54 -04:00
Kenneth Reitz
16c8241a81 v2.16.5 2017-05-28 00:35:36 -04:00
Kenneth Reitz
1dfa631dae updates to travis ci 2017-05-27 23:54:53 -04:00
Kenneth Reitz
1fa168eea4 tox.ini 2017-05-27 23:52:44 -04:00
Kenneth Reitz
8b5fa606ec improvements to help utility 2017-05-27 23:51:22 -04:00
Kenneth Reitz
148ab30d70 Merge pull request #4083 from kennethreitz/faster-ci
faster ci (test)
2017-05-27 20:37:37 -07:00
Kenneth Reitz
8d0c2537ee better comments 2017-05-27 23:34:56 -04:00
Kenneth Reitz
458008653c detox 2017-05-27 23:33:13 -04:00
Kenneth Reitz
679d368e3e setup.py improvements 2017-05-27 23:27:38 -04:00
Kenneth Reitz
7384fe71d6 let's see what this breaks 2017-05-27 23:22:49 -04:00
Kenneth Reitz
94331723d1 try again 2017-05-27 23:19:59 -04:00
Kenneth Reitz
b565b79858 skip that 2017-05-27 23:14:06 -04:00
Kenneth Reitz
a00d14a61f pytest 2017-05-27 23:11:01 -04:00
Kenneth Reitz
dc70edf17d try this 2017-05-27 23:09:38 -04:00
Kenneth Reitz
68fda6bcf2 see if that fixes things 2017-05-27 23:07:24 -04:00
Kenneth Reitz
141ce93445 test 2017-05-27 23:04:12 -04:00
Kenneth Reitz
6abe1ff933 update 2017-05-27 23:02:45 -04:00
Kenneth Reitz
3d425ac191 try this 2017-05-27 23:00:30 -04:00
Kenneth Reitz
0ff28d7421 faster 2017-05-27 22:57:45 -04:00
Kenneth Reitz
2758b8b0f0 improve speed of travis-ci 2017-05-27 22:56:43 -04:00
Kenneth Reitz
6746b2540d faster 2017-05-27 22:55:22 -04:00
Kenneth Reitz
03944f4cd6 restore old behavior 2017-05-27 20:33:32 -04:00
Kenneth Reitz
4a28ffcfe9 try this 2017-05-27 20:28:30 -04:00
Kenneth Reitz
b6d51d9f2b change test configuration 2017-05-27 20:25:11 -04:00
Kenneth Reitz
2edb553036 so frustrating 2017-05-27 20:23:02 -04:00
Kenneth Reitz
cffa0effe0 remove pytest-mock 2017-05-27 20:21:29 -04:00
Kenneth Reitz
76a66c41d6 final attempt 2017-05-27 20:19:42 -04:00
Kenneth Reitz
19a1379ff5 >=2.7 2017-05-27 20:17:33 -04:00
Kenneth Reitz
057689bb8a grr 2017-05-27 20:16:32 -04:00
Kenneth Reitz
88f28325c9 pytest 2017-05-27 20:15:17 -04:00
Kenneth Reitz
62afdabb30 blah 2017-05-27 20:11:04 -04:00
Kenneth Reitz
2468058fea better requirements 2017-05-27 20:09:58 -04:00
Kenneth Reitz
e4d8571080 concurrency in coverage report 2017-05-27 20:08:08 -04:00
Kenneth Reitz
048997daa0 better requirements 2017-05-27 20:07:35 -04:00
Kenneth Reitz
c166c4f5d4 remove circle.yml 2017-05-27 20:01:08 -04:00
Kenneth Reitz
f4b488b7f8 try removing that 2017-05-27 19:59:19 -04:00
Kenneth Reitz
cd4c701186 xdist 2017-05-27 19:57:40 -04:00
Kenneth Reitz
8e93b100da lets give this a try 2017-05-27 19:44:54 -04:00
Kenneth Reitz
276024b170 fix tests 2017-05-27 19:33:40 -04:00
Kenneth Reitz
6af910610f omg 2017-05-27 19:31:31 -04:00
Kenneth Reitz
1d76cb3572 cleanup tests (make them faster) 2017-05-27 19:30:13 -04:00
Kenneth Reitz
03e5f5daf3 socks needed for tests 2017-05-27 19:16:16 -04:00
Kenneth Reitz
b9a004a22b improvements 2017-05-27 17:25:44 -04:00
Kenneth Reitz
2e67c86075 merge 2017-05-27 17:24:06 -04:00
Kenneth Reitz
f0fb5034fc better headings 2017-05-27 17:14:10 -04:00
Kenneth Reitz
b0c19226c6 simplify 2017-05-27 17:12:50 -04:00
Kenneth Reitz
4e06345988 issue template 2017-05-27 17:09:52 -04:00
Kenneth Reitz
892fbe09f6 issue template 2017-05-27 17:08:50 -04:00
Kenneth Reitz
46a4e731da issue template 2017-05-27 17:07:30 -04:00
Kenneth Reitz
46a930941a issue template 2017-05-27 17:06:37 -04:00
Kenneth Reitz
c6827de846 better template 2017-05-27 17:03:17 -04:00
Kenneth Reitz
5c65f6d01e issue template 2017-05-27 17:01:09 -04:00
Kenneth Reitz
7ce5ca853d Merge pull request #4079 from kennethreitz/help
$ python -m requests.help
2017-05-27 13:58:19 -07:00
Kenneth Reitz
0ae8524e3b v2.16.4 2017-05-27 16:57:50 -04:00
Kenneth Reitz
bf4a813304 rename information/info 2017-05-27 16:50:51 -04:00
Kenneth Reitz
6d082ea972 add info about chardet and urllib3 2017-05-27 16:49:48 -04:00
Kenneth Reitz
f180980b28 Merge branch 'master' into bug-report-info 2017-05-27 13:41:54 -07:00
Kenneth Reitz
a44284c045 cleanup version.py 2017-05-27 12:41:11 -04:00
Kenneth Reitz
c1f32f68f6 v2.16.3 2017-05-27 12:20:34 -04:00
Kenneth Reitz
4c155de9fd test entrypoints 2017-05-27 11:06:53 -04:00
Kenneth Reitz
03dd91093b pep8 fix 2017-05-27 10:57:46 -04:00
Kenneth Reitz
d42556a936 2.16.2 2017-05-27 10:53:02 -04:00
Kenneth Reitz
103718847a v2.16.2 2017-05-27 10:52:47 -04:00
Kenneth Reitz
28666e5d3a vastly simpify making packages available for backwards compatibility 2017-05-27 10:49:57 -04:00
Kenneth Reitz
ecaa10543f fix setup.py 2017-05-27 10:33:10 -04:00
Kenneth Reitz
908c3b01ee restore packages to setup.py 2017-05-27 10:32:56 -04:00
Kenneth Reitz
c952e9e4e0 addded import stubs for urllib3 2017-05-27 10:29:00 -04:00
Kenneth Reitz
cceceecb68 fix history 2017-05-27 10:11:18 -04:00
Kenneth Reitz
e9ca4b39b4 more history 2017-05-27 10:09:57 -04:00
Kenneth Reitz
7962c12451 more history notes 2017-05-27 10:09:03 -04:00
Kenneth Reitz
f687e9f3d8 history 2017-05-27 09:58:37 -04:00
Kenneth Reitz
dc24bc3217 Merge branch 'master' of github.com:kennethreitz/requests 2017-05-27 09:37:17 -04:00
Kenneth Reitz
267ec2f9c3 restore package namespace 2017-05-27 09:37:09 -04:00
Kenneth Reitz
18c8924f14 better checking for urllib3 2017-05-27 09:37:02 -04:00
Kenneth Reitz
413f2a557c Update index.rst 2017-05-27 00:29:54 -04:00
Kenneth Reitz
04faf59f49 Update README.rst 2017-05-27 00:28:48 -04:00
Kenneth Reitz
bcd0e170ac requirements 2017-05-26 23:37:08 -04:00
Kenneth Reitz
a6c3a0ca72 Merge pull request #4067 from kennethreitz/deps
Deps (work in progress)
2017-05-26 20:33:28 -07:00
Kenneth Reitz
d2713412e5 v2.16.0 2017-05-26 23:24:42 -04:00
Kenneth Reitz
2b34880e2f sanity checks upon boot 2017-05-26 23:22:03 -04:00
Kenneth Reitz
de035b56f9 delete notice 2017-05-26 23:08:00 -04:00
Kenneth Reitz
1f6de03baf cleanup certs.py 2017-05-26 23:02:55 -04:00
Kenneth Reitz
0d7de6430e update certs 2017-05-26 22:58:59 -04:00
Kenneth Reitz
a00b7e4b25 no more certs file 2017-05-26 22:58:10 -04:00
Kenneth Reitz
c49ce5ae0b fix 2017-05-26 22:56:43 -04:00
Kenneth Reitz
6d3d5e59c9 fix models.py 2017-05-26 22:55:55 -04:00
Kenneth Reitz
af52bf795e remove bunk tests 2017-05-26 22:55:44 -04:00
Kenneth Reitz
f5f3e696ab fix makefile 2017-05-26 22:53:47 -04:00
Kenneth Reitz
47f170bb35 fix __init__.py 2017-05-26 22:53:28 -04:00
Kenneth Reitz
168109f13c fix adapters.py 2017-05-26 22:52:29 -04:00
Kenneth Reitz
8a2014e265 fix compat.py 2017-05-26 22:51:40 -04:00
Kenneth Reitz
1d31b36148 fix exceptions.py 2017-05-26 22:50:43 -04:00
Kenneth Reitz
6c41633cfd fix models.py 2017-05-26 22:50:13 -04:00
Kenneth Reitz
6ef7298466 fix sessions.py 2017-05-26 22:49:43 -04:00
Kenneth Reitz
818daff12a more test removal of old imports 2017-05-26 22:48:58 -04:00
Kenneth Reitz
0bb200515c remove test imports from packages 2017-05-26 22:48:01 -04:00
Kenneth Reitz
628633143d require certifi 2017-05-26 22:46:46 -04:00
Kenneth Reitz
1ea27b3564 add install_requires 2017-05-26 22:44:56 -04:00
Kenneth Reitz
8e17600ef6 delete packages 2017-05-26 22:44:48 -04:00
Kenneth Reitz
282b01a7c9 new release 2017-05-26 22:13:29 -04:00
Kenneth Reitz
e1539ac8ff everyone makes mistakes :P 2017-05-26 22:12:38 -04:00
Kenneth Reitz
8c2a36140b fix for python 3 2017-05-26 22:08:46 -04:00
Kenneth Reitz
60b9fb17af too much 2017-05-26 21:48:35 -04:00
Kenneth Reitz
0aee483497 fix setup.py 2017-05-26 21:43:03 -04:00
Kenneth Reitz
bf53ace6f8 v2.15.0 2017-05-26 21:38:23 -04:00
Kenneth Reitz
4c3d307eb9 Merge pull request #4052 from hile/master
Fix regression in API caused by commit 85400d8d6751071ef78f042d1efa72…
2017-05-26 18:34:30 -07:00
Kenneth Reitz
380d130245 Merge pull request #4066 from kennethreitz/next
API improvements
2017-05-26 18:33:28 -07:00
Kenneth Reitz
c3367d1854 remove Request.send(session) 2017-05-26 21:28:52 -04:00
Kenneth Reitz
a7239aab84 feedback from @sigmavirus42 2017-05-26 21:23:55 -04:00
Kenneth Reitz
dfd667df96 who wrote this shit 2017-05-26 21:17:13 -04:00
Kenneth Reitz
f41560c5d4 fix the tests 2017-05-26 21:15:58 -04:00
Kenneth Reitz
ce64cce14e API improvements 2017-05-26 21:07:37 -04:00
Kenneth Reitz
60041f5169 Create CODE_OF_CONDUCT.md 2017-05-26 20:32:06 -04:00
Kenneth Reitz
14d6fa1472 __version__.py 2017-05-25 20:07:38 -04:00
Kenneth Reitz
64efd9cfe0 yay i knew i wasn't crazy 2017-05-25 20:07:23 -04:00
Kenneth Reitz
1001bc671a fix imports 2017-05-25 19:58:44 -04:00
Kenneth Reitz
733ff4b8a4 Merge branch 'master' of github.com:kennethreitz/requests 2017-05-25 19:52:31 -04:00
Kenneth Reitz
296c215762 __version__ 2017-05-25 19:52:17 -04:00
Kenneth Reitz
cc7b3ee7ed Merge pull request #4064 from sigmavirus24/fix-rtfd
Avoid breaking people using requests.__version__
2017-05-25 16:46:08 -07:00
Ian Cordasco
e038aad3cc Avoid breaking people using requests.__version__
Using __version__ as a module breaks users who expect
requests.__version__ to be the version string.
2017-05-25 18:44:30 -05:00
Kenneth Reitz
4f8f4b5fb3 Merge pull request #4063 from kennethreitz/version
fix rtd
2017-05-25 16:24:02 -07:00
Kenneth Reitz
ce882a2eae fix rtd 2017-05-25 19:07:48 -04:00
Kenneth Reitz
f581dc95a9 Merge pull request #4059 from kennethreitz/version
__version__.py
2017-05-25 09:39:43 -07:00
Kenneth Reitz
7abfd92aea take a page out of @sigmavirus42's book 2017-05-25 11:46:12 -04:00
Kenneth Reitz
9fbfd22f6b take a page out of @sigmavirus42's book 2017-05-25 11:46:00 -04:00
Kenneth Reitz
e634ab73b2 better '' 2017-05-25 11:33:04 -04:00
Kenneth Reitz
3e32356716 __version__.py 2017-05-25 11:31:38 -04:00
Kenneth Reitz
539302a17d Update README.rst 2017-05-25 10:47:13 -04:00
Cory Benfield
037108178c Merge pull request #4056 from Lukasa/pytest-httpbin-fix
Disable pytest messing with warnings.
2017-05-24 10:46:11 -07:00
Cory Benfield
f3d310b299 Turns out @kennethreitz suprise-broke the CI 2017-05-24 10:20:07 -07:00
Cory Benfield
874bca97cb Disable pytest messing with warnings.
We may be able to remove this if pytest resolves pytest-dev/pytest#2430
2017-05-24 10:04:56 -07:00
Kenneth Reitz
dbb67a1310 Update __init__.py 2017-05-24 08:50:22 -07:00
Ilkka Tuohela
a9470fe31f Fix regression in API caused by commit 85400d8d67
- The added optional parameter changes API and should default to None

    This utility call is used by for example requestbuilder package directly
    which breaks because it passes only one argument to the function as it
    used to be.
2017-05-24 08:47:46 +03:00
Kenneth Reitz
0ba21a79c4 progress 2017-05-22 16:08:01 -07:00
Kenneth Reitz
66293b830a progress 2017-05-22 15:38:17 -07:00
Kenneth Reitz
6fb9b1ce53 fix lack of taste
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-05-21 23:25:18 -07:00
Kenneth Reitz
2772413f3d Update index.rst 2017-05-21 08:25:50 -07:00
Cory Benfield
ba63e50ecd Merge pull request #4041 from jdufresne/bdist_wheel
Add setup.cfg to declare wheel as universal
2017-05-20 08:11:11 -07:00
Jon Dufresne
2c71f2d520 Add setup.cfg to declare wheel as universal
As the project is pure Python, a built wheel should always be universal,
so define in the project globally. Can remove --universal command from
Makefile.

See:

http://pythonwheels.com/
2017-05-20 07:39:09 -07:00
Cory Benfield
fb3f2a030f Merge branch 'kaptajnen-master' 2017-05-18 09:05:03 -07:00
Jonas Laursen
00c6ad58b7 Simplify fix for #4025 2017-05-18 09:04:34 -07:00
Jonas Laursen
af66521381 Fix #4025 2017-05-18 09:04:34 -07:00
Ian Cordasco
a8bfa82801 Merge pull request #4026 from floppym/sdist-tests
Include tests in sdist tarball
2017-05-18 09:50:40 -05:00
Ian Cordasco
6ab6a18ab2 Merge pull request #4033 from Lukasa/issue/4030
Test that the readme renders in CI.
2017-05-17 20:41:00 -05:00
Ian Cordasco
570c4c83a5 Amend the syntax for skipping the readme check 2017-05-17 20:06:42 -05:00
Cory Benfield
e2142a1e54 Alex said this would work 2017-05-17 18:02:28 -07:00
Ian Cordasco
52a2efa2ae Avoid verifying the README.rst on Python 2.6
readme-render does not appear to support Python 2.6. This causes tests to fail
on Travis' 2.6 environment.
2017-05-17 19:54:31 -05:00
Ian Cordasco
f88e573c18 Merge branch 'master' into issue/4030 2017-05-17 19:36:49 -05:00
Cory Benfield
da29295369 Merge pull request #4036 from nateprewitt/pin_sphinx
Pin sphinx
2017-05-17 15:47:48 -07:00
Nate Prewitt
dbdbffd7f5 Stop creating Pipfile.lock on every make.
Pipenv used to require the file to be locked on each individual platform,
but as of v4.0.0, that is no longer necessary. Removing the forced call
to lock will speed up builds in CI.
2017-05-17 13:21:11 -07:00
Nate Prewitt
a3f2972c4f Temporarily cap Sphinx at 1.5.5 for Python 2.6 compatibility 2017-05-17 13:20:19 -07:00
Cory Benfield
1553770014 Fixup broken changelog 2017-05-17 10:54:06 -07:00
Cory Benfield
37ef88885c Test the readme in travis 2017-05-17 10:46:05 -07:00
Cory Benfield
2cb07872fe Add a makefile target for testing the readme 2017-05-17 10:44:14 -07:00
Mike Gilbert
2667c772b9 Include tests in sdist tarball
Fixes: https://github.com/kennethreitz/requests/issues/4024
2017-05-16 18:59:23 -04:00
Cory Benfield
0280a18b53 Merge pull request #4015 from nateprewitt/update_manifest
remove old test_requests.py listing from MANIFEST.in
2017-05-10 20:04:03 +01:00
Nate Prewitt
f4b90827b0 remove old test_requests.py listing from MANIFEST.in 2017-05-10 09:58:22 -06:00
Cory Benfield
e4693eba4f v2.14.2 2017-05-10 15:04:22 +01:00
Cory Benfield
2e496c3e1d Merge pull request #4014 from Lukasa/even-more-compat
Remove range operators from markers.
2017-05-10 15:02:54 +01:00
Cory Benfield
f3f4c3e20a Remove range operators from markers 2017-05-10 14:19:46 +01:00
Cory Benfield
3618f3f68e v2.14.1 2017-05-09 19:58:39 +01:00
Cory Benfield
f909314652 Changelog for v2.14.1 2017-05-09 19:58:15 +01:00
Cory Benfield
636082fa8f Merge pull request #4007 from Lukasa/use-more-comaptible-marker
Use sys_platform instead of platform_system
2017-05-09 19:55:56 +01:00
Cory Benfield
800a074b5d Use sys_platform instead of platform_system
This is more compatible as a marker and so will break fewer people.
2017-05-09 19:10:31 +01:00
Cory Benfield
508d47dc6e v2.14.0 2017-05-09 16:44:27 +01:00
Cory Benfield
bf1a2a4e39 Merge pull request #4004 from Lukasa/prepare-2.14
Prepare for 2.14 release.
2017-05-09 16:42:02 +01:00
Cory Benfield
ddada2d750 We no longer downcase some hosts. 2017-05-09 10:08:06 +01:00
Cory Benfield
074c4a32d8 Update certifi to 2017.4.17 2017-05-09 09:37:52 +01:00
Cory Benfield
debc5de6d4 Update idna to v2.5 2017-05-09 09:36:27 +01:00
Cory Benfield
4bad52caa2 Update chardet to v3.0.2 2017-05-09 09:34:51 +01:00
Cory Benfield
d49f3e258c Update urllib3 to v1.21.1 2017-05-09 09:21:08 +01:00
Cory Benfield
823519d45c Bring changelog up to date. 2017-05-09 09:18:18 +01:00
Kenneth Reitz
f8189eda10 Merge pull request #4001 from bowlofeggs/seconds
Specify that the timeout parameter is in seconds.
2017-05-07 00:07:02 -04:00
Randy Barlow
3d813c9a7a Specify that the timeout parameter is in seconds.
Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
2017-05-06 21:25:50 -04:00
Kenneth Reitz
379025a1bc Update README.rst 2017-05-05 12:54:20 -04:00
Kenneth Reitz
176ba43869 Update README.rst 2017-05-05 12:53:17 -04:00
Kenneth Reitz
7ae662dec9 reddit 2017-05-04 11:59:36 -04:00
Cory Benfield
216aee441d Merge pull request #3979 from schlamar/bypass-proxy
improve proxy bypass on Windows
2017-05-04 15:18:30 +01:00
schlamar
5c389cf3f5 update changelog 2017-05-04 15:31:54 +02:00
schlamar
1c38e1f5f6 proxy bypass on Windows without DNS lookups 2017-05-04 10:44:47 +02:00
schlamar
4f34446b36 test proxy bypass with config from registry 2017-05-04 07:46:59 +02:00
schlamar
724fd44b97 revert 8e6e47af and c121b98c 2017-05-04 07:46:59 +02:00
Kenneth Reitz
26ab951300 Update index.rst 2017-05-03 13:26:15 -04:00
Kenneth Reitz
eae38b8d13 Merge pull request #3988 from Lukasa/fix-appveyor
[WIP] Fix up appveyor testing.
2017-05-03 13:25:25 -04:00
Cory Benfield
fcc3b7d7b1 Document the minor changes made 2017-05-03 15:28:39 +01:00
Cory Benfield
d89f8c0d70 Fix up Appveyor testing 2017-05-03 13:19:46 +01:00
Thomas Grainger
8db8a7d82d configure sudo: false on travis 2017-05-03 09:23:02 +01:00
Cory Benfield
84099eea9f Merge pull request #3991 from chrisgavin/unused-imports
Remove some unused imports.
2017-04-26 13:09:34 +01:00
Chris Gavin
19ba9f1097 Remove some unused imports. 2017-04-25 22:10:01 +01:00
Kenneth Reitz
44106f18b7 Update AUTHORS.rst 2017-04-25 11:06:38 -04:00
Kenneth Reitz
d0a072e15d Merge pull request #3983 from Lukasa/appveyor
Add appveyor testing of Requests.
2017-04-24 12:49:25 -04:00
Cory Benfield
fae7530a17 Add Python 3.6 2017-04-24 08:22:56 +01:00
Cory Benfield
8d6f7e6854 Add appveyor testing of Requests 2017-04-21 12:07:27 +01:00
Cory Benfield
f6c58ec582 Merge pull request #3982 from graingert/travis-sudo-false
configure sudo: false on travis
2017-04-21 11:54:33 +01:00
Thomas Grainger
047056c150 configure sudo: false on travis 2017-04-21 11:37:38 +01:00
Cory Benfield
52a3526a99 Merge pull request #3981 from graingert/cache-pip
enable travis pip cache
2017-04-21 11:32:41 +01:00
Thomas Grainger
af383b3968 enable travis pip cache 2017-04-21 11:21:59 +01:00
Cory Benfield
524627ef21 Merge pull request #3978 from graingert/remove-seemingly-redundant-pyflakes-references
remove seemingly redundant pyflakes references
2017-04-20 09:44:19 -04:00
Thomas Grainger
fcb272cc36 remove seemingly redundant pyflakes references 2017-04-20 13:23:56 +01:00
Cory Benfield
b8674db246 Merge pull request #3969 from shmuelamar/master
fix handle of non-ascii location on redirects issue #3888
2017-04-18 12:20:22 -04:00
shmuelamar
722b1dae96 fix handle of non-ascii location on redirects 2017-04-18 00:08:59 +03:00
Cory Benfield
fd7dcd2785 Merge pull request #3963 from shmuelamar/master
fix unicode decode error on py2 when handling redirect without scheme
2017-04-14 16:13:49 -04:00
shmuelamar
a3e597c171 fix unicode decode error on py2 when handling redirect without scheme 2017-04-14 16:20:27 +03:00
Cory Benfield
84a6040762 Merge pull request #3958 from Xuanwo/typo-fix
Fix a typo in utils
2017-04-08 14:18:43 +01:00
Xuanwo
1cd173a82c Fix a typo in utils
Signed-off-by: Xuanwo <xuanwo.cn@gmail.com>
2017-04-08 20:56:28 +08:00
Cory Benfield
f061fb7e28 Merge pull request #3956 from rubendura/master
Fixes DeprecationWarnings in Python 3.6 due to invalid escape sequences
2017-04-05 16:29:41 +01:00
Ruben Dura Tari
ead8fba84b Fixes DeprecationWarnings in Python 3.6 due to invalid escape sequences. Fixes #3954 2017-04-05 15:51:58 +01:00
Cory Benfield
342096a3b9 Merge pull request #3943 from leo-b/timeout
HTTPAdapter.send() timeout defaults
2017-04-03 16:45:11 +01:00
Alexander 'Leo' Bergolth
1be6a17edc oops! import Timeout as Urllib3Timeout 2017-04-03 16:49:46 +02:00
Alexander 'Leo' Bergolth
28768b945c use @pytest.mark.parametrize 2017-04-03 16:32:38 +02:00
Alexander 'Leo' Bergolth
93cb1ca763 add some tests for passing in Timeout objects 2017-04-02 15:20:29 +02:00
Cory Benfield
1be8e19403 Merge pull request #3952 from tonybaloney/master
Small help in docs to indicate client side authentication
2017-04-02 11:41:53 +01:00
Anthony Shaw
a63ae02e34 Update sessions.py
Update docstring for the session init to explain what the cert kwarg types are for.
2017-04-02 20:29:48 +10:00
Anthony Shaw
3cb7539981 Update advanced.rst
break client side certificates out into a sub header
2017-04-02 20:21:37 +10:00
Alexander 'Leo' Bergolth
4c13678587 remove change for timeout=None 2017-03-30 16:20:39 +02:00
Alexander 'Leo' Bergolth
1e7ae063ce whitespace 2017-03-29 18:20:11 +02:00
Alexander 'Leo' Bergolth
fe58c6fdd6 small rearrangement 2017-03-29 18:01:18 +02:00
Alexander 'Leo' Bergolth
a180db963f allow urllib3 Timeout objects as timeout parameter for HTTPAdapter.send()
omit timeout argument when calling urlopen on the connection. this allows setting a default timeout at connection pool level:
adapter.poolmanager.connection_pool_kw['timeout'] = urllib3.Timeout(...)
2017-03-29 16:53:28 +02:00
Ian Cordasco
567e12bfb8 Add debugging submodule for bug reporters
The suggested usage in a bug report would be

    python -c 'from requests import _bug; _bug.print_information()'

This should generate most of the information we tend to ask for
repeatedly from bug reporters.
2017-03-23 07:22:55 -05:00
Cory Benfield
993cbf5741 Merge pull request #3927 from bagerard/raise_IOError_invalid_certificate_files
Raise IOError when providing an invalid path to a CA bundle or …
2017-03-22 20:41:07 +00:00
Bastien Gérard
4207867aaf PR review fixes:
- used httpbin_secure for tests
- updated docstring related to `verify` param"
- used TLS acronym instead of SSL
2017-03-22 21:28:38 +01:00
Bastien Gérard
42ec8b08f2 #3927 fixes based on review 2017-03-22 21:28:38 +01:00
Bastien Gérard
7d8b87c37f #3926 raise IOError when providing an invalid path to a CA bundle or certificate files 2017-03-22 21:28:38 +01:00
Kenneth Reitz
b60c5a5ed4 Merge branch 'master' of github.com:kennethreitz/requests 2017-03-19 21:14:17 -04:00
Kenneth Reitz
1cb759a9d9 roman numberals 2017-03-19 21:14:08 -04:00
Cory Benfield
552ab7a064 Merge pull request #3922 from bgschiller/patch-1
Change apostrophe placement in advanced.rst
2017-03-14 15:40:49 +00:00
Brian Schiller
e0ba82949b Change apostrophe placement in advanced.rst
See Rule2a on http://www.grammarbook.com/punctuation/apostro.asp
2017-03-14 10:09:41 -05:00
Cory Benfield
29085e7d95 Merge pull request #3920 from dufferzafar/patch-1
Update README.rst - add 'of'
2017-03-09 08:16:31 +00:00
Shadab Zafar
4acdb99752 Update README.rst 2017-03-09 12:49:52 +05:30
Cory Benfield
c43fefa7ed Merge pull request #3913 from StyXman/patch-1
Add mention to list of tuples as data param.
2017-03-07 09:43:26 +00:00
Marcos Dione
2e9e944bc1 Removed sentence as suggested.
Fair enough...
2017-03-07 10:34:21 +01:00
Marcos Dione
16f6e25176 Add mention to list od tuples as data param.
`requests.request` accepts list of tuples in the `data` param, but thereś no mention of it in the docs.
2017-03-07 10:26:51 +01:00
Cory Benfield
62bd9247ba Merge pull request #3909 from sigmavirus24/updates-for-3885
Update implementation of TimedCache object
2017-03-04 15:27:45 +00:00
Ian Cordasco
8e6e47af43 Update implementation of TimedCache object
There were some odd decisions made about the implementation of some of
the required methods for MuttableMapping in the TimedCache object. This
cleans those up and makes the implementation, ever so slightly, easier
to read.

See also #3885
2017-03-04 09:03:03 -06:00
Kenneth Reitz
41a33f2e86 Update README.rst 2017-03-02 17:31:38 -08:00
Cory Benfield
3e0d78fdaf Merge pull request #3901 from nedbat/master
Smaller logo
2017-03-01 20:05:13 +00:00
Ned Batchelder
eca8351491 Smaller logo 2017-03-01 14:52:34 -05:00
Gary Wu
21972c4601 fix #3902 Add proposed documentation change for post data 2017-03-01 13:04:11 -06:00
Cory Benfield
3f3df8b5ff Merge pull request #3900 from lutzhorn/master
fixed #3894 by mentioning form-encoding of dict
2017-03-01 15:30:36 +00:00
Lutz Horn
3d22f9f5ab fixed #3894 by mentioning form-encoding of dict
The optional `data` parameter will be form-encoded, if a dictionary is provided.
2017-03-01 16:00:08 +01:00
Victor Pfautz
2aaf6ac038 Fixed some typos (#3892)
* Fixed some typos
2017-02-27 16:25:10 +00:00
Cory Benfield
45a2977e1b Merge pull request #3885 from davidfontenot/cache_proxy_bypass
Cache proxy bypass
2017-02-27 08:56:43 +00:00
David Fontenot
c121b98c4e wrapped proxy_bypass() with cache lookup
Used to alleviate long gethostbyaddr calls
Made new TimedCache and decorator to wrap
a function with a cache
* Entries looked up older than a minute (default amount)
are evicted.
* When full, evicts the oldest entry
2017-02-23 14:04:16 -08:00
Ian Cordasco
d6f4818c0b Merge pull request #3877 from sigmavirus24/update-docstring
Correct docstring for Response.ok
2017-02-16 07:37:18 -06:00
Ian Cordasco
8e049bd9eb Update docstrings for Response.__{bool,nonzero}__
Like the docstring added to Response.ok these were misleading and
vaguely incorrect. Better to be explicit than implicit.
2017-02-16 07:21:15 -06:00
Ian Cordasco
7a281e74ec Correct docstring for Response.ok 2017-02-16 07:15:37 -06:00
Cory Benfield
e674aa1c8c Merge pull request #3876 from mislavcimpersak/hotfix/response_ok_docstring
added docstring for response.ok property
2017-02-16 09:30:11 +00:00
Mislav Cimperšak
3664682539 added docstring for response.ok property 2017-02-16 10:06:28 +01:00
Kenneth Reitz
655f0edbb4 better testimonials 2017-02-14 17:00:17 -05:00
Ian Cordasco
2414fa82c8 Merge pull request #3873 from nateprewitt/super_len_fix
properly handled failed seek
2017-02-14 09:43:19 -06:00
Nate Prewitt
f47aff68f1 properly handled failed seek 2017-02-14 07:45:41 -07:00
Kenneth Reitz
90f3842ed6 edmsynths 2017-02-12 02:18:50 -05:00
Kenneth Reitz
6cbebf782a fixes 2017-02-11 15:17:27 -05:00
Kenneth Reitz
f2fe735846 fixes 2017-02-11 15:16:09 -05:00
Kenneth Reitz
e7b7574cfe hhg2p 2017-02-11 15:14:47 -05:00
Kenneth Reitz
6bd6249051 Merge pull request #3865 from JohnVillalovos/master
Allow use of 'no_proxy' in the proxies argument
2017-02-10 15:50:10 -06:00
Kenneth Reitz
453397965b Merge pull request #3846 from jvanasco/feature-pluggable_handling
initial attempt at `get_redirect_target`
2017-02-10 15:46:13 -06:00
jonathan vanasco
70f31a3166 * initial attempt at get_redirect_target
* removing the `i` from the redirect detection while-loop
2017-02-10 13:53:23 -05:00
John L. Villalovos
85400d8d67 Allow use of 'no_proxy' in the proxies argument
Add the ability to add 'no_proxy' and a value to the 'proxies'
dictionary argument.

https://github.com/kennethreitz/requests/issues/2817

Closes gh-2817
2017-02-10 09:41:54 -08:00
Cory Benfield
ad65b0cb19 Merge pull request #3862 from mattkohl/master
Updated docs for Pipenv
2017-02-10 12:19:01 +00:00
mattkohl
57659e5987 Removed duplicate key in Pipfile 2017-02-10 11:46:59 +00:00
mattkohl
c134388a43 Removed requirements.txt from MANIFEST.in 2017-02-10 10:51:14 +00:00
mattkohl
b41bb9ecb2 Added name & github link 2017-02-10 10:48:15 +00:00
mattkohl
a3e671d717 Updated test instructions for Pipenv 2017-02-10 10:47:40 +00:00
mattkohl
7b190acf82 Updated Pipfile to reflect version specs in setup.py; added Sphinx 2017-02-10 10:46:35 +00:00
mattkohl
a0b97253c2 Removed docs-init (depended on missing docs/requirements.txt) 2017-02-10 10:45:06 +00:00
Kenneth Reitz
84749f08bc Update README.rst 2017-02-09 21:31:38 -05:00
Kenneth Reitz
e63dd1a66b Update README.rst 2017-02-09 21:31:14 -05:00
Ian Cordasco
0bea453913 Merge pull request #3857 from Lukasa/params-docs
Say that we use a dictionary of strings.
2017-02-08 06:05:50 -06:00
Cory Benfield
08ce652b8b Say that we use a dictionary of strings. 2017-02-08 11:54:32 +00:00
Cory Benfield
5c68b8f227 Merge pull request #3853 from StyXman/500-small-head
Do not convert /o\ into /O\
2017-02-07 16:04:24 +00:00
Marcos Dione
571d2c2cd7 Fix syntax error
I can only wonder how I managed to write it like that...
2017-02-07 16:57:17 +01:00
Marcos Dione
b00d8bf474 Proper version, no bugs, shorter. 2017-02-06 21:44:28 +01:00
Marcos Dione
593734b770 do not convert /o\ into /O\ 2017-02-06 17:27:16 +01:00
Cory Benfield
af4052b020 Merge pull request #3851 from nateprewitt/remove_pin
remove pin
2017-02-03 17:21:13 +00:00
Nate Prewitt
f521a25970 remove pin 2017-02-03 09:29:13 -07:00
Kenneth Reitz
62176a1ca7 2017 2017-02-02 16:12:33 -05:00
Kenneth Reitz
f278344e01 updated pipfile 2017-02-02 16:12:29 -05:00
Kenneth Reitz
c2c523ba9e docs 2017-02-02 15:22:01 -05:00
Kenneth Reitz
abaeeb8807 improved sidebar 2017-02-02 15:19:31 -05:00
Kenneth Reitz
6bd091ca70 improved homepage 2017-02-02 15:18:24 -05:00
Kenneth Reitz
260763a83d better say thanks icon 2017-02-02 15:06:54 -05:00
Kenneth Reitz
5ac53c69c7 11,000,000! 2017-02-02 14:09:31 -05:00
Kenneth Reitz
8c6e9388e7 Merge branch 'master' of github.com:kennethreitz/requests 2017-02-02 14:06:07 -05:00
Kenneth Reitz
036b5d34fd better sidebar for docs 2017-02-02 14:05:07 -05:00
Cory Benfield
f4a3aa42b6 Merge pull request #3841 from TetraEtc/happy-new
Update Copyright in LICENSE to 2017
2017-01-31 08:54:28 +00:00
TetraEtc
1a4ba6c833 Update LICENSE 2017-01-31 13:03:12 +10:00
Cory Benfield
e84086ac86 Merge pull request #3835 from mmedal/master
Only send HTTPDigestAuth on 4xx challenges
2017-01-29 09:15:35 +01:00
Matthew Medal
8a58427d8a Only send HTTPDigestAuth on 4xx challenges
Resolves: #3772
2017-01-27 12:56:50 -08:00
Cory Benfield
d3c97dda11 Merge pull request #3836 from nateprewitt/pin_pipenv
pin pipenv until kennethreitz/pipenv#90 is resolved
2017-01-27 20:55:06 +00:00
Nate Prewitt
808e4c62dc pin pipenv until kennethreitz/pipenv#90 is resolved 2017-01-27 13:42:22 -07:00
Cory Benfield
23057dbc22 Merge pull request #3832 from nateprewitt/master
fixing codecov with pipenv
2017-01-25 15:40:30 +00:00
Nate Prewitt
795106c188 fixing codecov with pipenv 2017-01-24 21:29:22 -07:00
Kenneth Reitz
b92058b6fe empty commit 2017-01-24 23:08:27 -05:00
Kenneth Reitz
1da52c04d4 attempted fix for travis 2017-01-24 23:04:25 -05:00
Kenneth Reitz
cf07efa534 give up 2017-01-24 22:51:24 -05:00
Kenneth Reitz
9e681a4a9f fix makefle 2017-01-24 21:22:16 -05:00
Kenneth Reitz
efa030eae3 proper pipfile.lock 2017-01-24 21:13:18 -05:00
Kenneth Reitz
c008465d24 pypi/simple 2017-01-24 21:09:21 -05:00
Kenneth Reitz
7cad64ac5a use proper names 2017-01-24 21:02:06 -05:00
Kenneth Reitz
014ec0eb26 Merge remote-tracking branch 'origin/master' 2017-01-24 20:59:59 -05:00
Kenneth Reitz
600ee2bf2b updated lockfile 2017-01-24 20:59:26 -05:00
Kenneth Reitz
d291202db0 Merge pull request #3830 from nateprewitt/fixing_pipfile_source
Fixing Pipfile source
2017-01-24 20:57:59 -05:00
Nate Prewitt
9a2a316f08 updating Pipfile.lock 2017-01-24 16:05:46 -07:00
Nate Prewitt
b12272d7d1 updating Pipfile source to a useable pypi endpoint 2017-01-24 16:05:33 -07:00
Kenneth Reitz
fee0e94a76 empty commit 2017-01-24 13:27:38 -05:00
Cory Benfield
fc54869da0 Merge pull request #3828 from sigmavirus24/blacklist-pipenv
Blacklist known bad version of pipenv
2017-01-24 13:13:52 +00:00
Ian Cordasco
6a415a02cf Blacklist known bad version of pipenv
We pinned pipenv to release v2.13.0 but in reality, we could have just
blacklisted the known bad version. For future us, we now blacklist it.
2017-01-24 07:05:30 -06:00
Cory Benfield
e3f89bf23c Merge pull request #3827 from sigmavirus24/release/2.13
Release v2.13.0
2017-01-24 12:52:22 +00:00
Ian Cordasco
32548e2bb6 Pin pipenv to fix CI 2017-01-24 06:45:29 -06:00
Ian Cordasco
b2289cd2d5 Bump version for 2.13.0
Add release notes for 2.13.0
2017-01-24 06:32:12 -06:00
Ian Cordasco
4d00d47a5a Use twine for publishing Requests 2017-01-24 06:22:58 -06:00
Ian Cordasco
af1b542e20 Update idna to v2.2.0 2017-01-24 06:20:44 -06:00
Ian Cordasco
b5704a63ca Update urllib3 to 1.20.0
Further, fix the Makefile to pull urllib3 from the release branch.
git-describe works based on the most recent commit but all of the
nearest commits in the graph for urllib3 are on the release branch
(since the release branch is never merged back to master).
2017-01-24 06:16:54 -06:00
Kenneth Reitz
df56f38bb4 Update README.rst 2017-01-22 17:44:28 -05:00
Kenneth Reitz
304e4cb5ee Update README.rst 2017-01-22 17:42:04 -05:00
Kenneth Reitz
c7a4819c84 Update README.rst 2017-01-22 17:38:21 -05:00
Kenneth Reitz
e32e7108d0 trying this 2017-01-22 00:44:04 -05:00
Kenneth Reitz
97b5bc21d1 fix broken tests 2017-01-21 21:41:16 -05:00
Kenneth Reitz
ed9004f30e no need for this anymore! 2017-01-21 21:36:00 -05:00
Kenneth Reitz
ab3c21cf96 empty commit 2017-01-21 21:32:27 -05:00
Kenneth Reitz
9c67691b90 empty commit 2017-01-21 21:28:50 -05:00
Kenneth Reitz
03d96aa9f7 empty commit 2017-01-21 21:19:25 -05:00
Kenneth Reitz
5b801847c4 empty commit 2017-01-21 21:12:03 -05:00
Kenneth Reitz
8f6e990066 empty commit 2017-01-21 21:09:29 -05:00
Kenneth Reitz
5eb2df1acf empty commit 2017-01-21 21:06:29 -05:00
Kenneth Reitz
62b014560a use git 2017-01-21 21:03:46 -05:00
Kenneth Reitz
73018f40a3 empty commit 2017-01-21 20:57:48 -05:00
Kenneth Reitz
358bb766d0 empty commit 2017-01-21 20:53:21 -05:00
Kenneth Reitz
2a2dd1389b empty commit 2017-01-21 20:50:20 -05:00
Kenneth Reitz
8ae576193c empty commit 2017-01-21 20:45:04 -05:00
Kenneth Reitz
c619bea722 empty commit 2017-01-21 20:45:00 -05:00
Kenneth Reitz
c6973d31ca last attempt 2017-01-21 20:27:33 -05:00
Kenneth Reitz
0938c9e985 one more time 2017-01-21 20:22:29 -05:00
Kenneth Reitz
bb6f5a1d93 --global 2017-01-21 20:12:15 -05:00
Kenneth Reitz
efe0608cdd empty commit 2017-01-21 20:08:36 -05:00
Kenneth Reitz
0ad2792873 trying again 2017-01-21 19:47:39 -05:00
Kenneth Reitz
c00783cd86 let's see if this works 2017-01-21 19:45:44 -05:00
Cory Benfield
4c53915a21 Merge pull request #3789 from moin18/3780
3780: Lazy load idna library
2017-01-19 09:19:00 +00:00
Cory Benfield
5dcc039457 v2.12.5 2017-01-18 12:41:46 +00:00
Cory Benfield
4ada39841b Merge pull request #3823 from Lukasa/changes-2.13.5
Prepare changelog for 2.12.5
2017-01-18 12:41:04 +00:00
Cory Benfield
219d9a7297 Prepare changelog for 2.12.5 2017-01-18 12:23:41 +00:00
Kenneth Reitz
160d364503 RIP Readability 2017-01-17 18:10:25 -05:00
Kenneth Reitz
8344b0b409 link to twitter 2017-01-17 18:09:47 -05:00
Kenneth Reitz
5259966547 yes 3.7 too 2017-01-17 18:09:09 -05:00
Kenneth Reitz
84ee1d4a42 yes, 3.7 too 2017-01-17 18:08:36 -05:00
Kenneth Reitz
23ac7256ea Update README.rst 2017-01-17 18:07:10 -05:00
Kenneth Reitz
52b5ed18c1 cleanup makefile 2017-01-17 18:03:23 -05:00
Kenneth Reitz
a68f7169a5 omit coverage packages 2017-01-17 17:56:19 -05:00
Kenneth Reitz
65fb2a50c8 further fix the build 2017-01-17 17:48:36 -05:00
Kenneth Reitz
d374a182d9 fixing build 2017-01-17 17:44:22 -05:00
Kenneth Reitz
115b438e6a typo 2017-01-17 17:37:21 -05:00
Kenneth Reitz
96fbe9e8c9 get codecov to work 2017-01-17 17:34:33 -05:00
Kenneth Reitz
a1d058c6b1 empty commit 2017-01-17 17:15:50 -05:00
Moin
fae3f92c34 lazily load idna library 2017-01-17 20:34:15 +05:30
Cory Benfield
580b45dd3c Merge pull request #3812 from inglesp/patch-1
Add default value of allow_redirects to docs
2017-01-12 17:12:53 +00:00
Peter Inglesby
2432dd6208 Add default value of allow_redirects to docs 2017-01-12 17:00:42 +00:00
Cory Benfield
e2bd1f9100 Merge pull request #3809 from JungWinter/master
Remove unused module from tests
2017-01-11 09:49:59 +00:00
winterJ
e8c0a99cb1 Remove unused module 2017-01-11 18:20:52 +09:00
Cory Benfield
1c69fc2108 Merge pull request #3804 from ncoghlan/patch-1
Improve discoverability of OAuth 2 support
2017-01-10 08:31:58 +00:00
Nick Coghlan
775d19ee05 Explicitly mention OpenID Connect
OAuth 2 is the authentication protocol underpinning OpenID Connect.

Mention that explicitly for the benefit of folks looking for information on using
requests with OpenID Connect that don't yet know that OAuth 2 is the
relevant underlying authentication protocol.
2017-01-10 15:31:20 +10:00
Nick Coghlan
4942b40496 Improve discoverability of OAuth 2 support
The previous summary gave the impression that requests-oauthlib only supports
OAuth 1.

This updates makes it clear that it also supports OAuth 2, and links directly to the
use case specific authentication flow guides.
2017-01-10 15:17:08 +10:00
Kenneth Reitz
ba7101e2cd Update .travis.yml 2017-01-08 23:13:47 -05:00
Kenneth Reitz
a43845e729 Merge pull request #3801 from andriisoldatenko/add-python-36
Added python 3.6.0
2017-01-08 23:13:04 -05:00
Andrii Soldatenko
2bcaff99ea Added python 3.6.0 2017-01-09 00:40:32 +02:00
Kenneth Reitz
57933d4d45 Merge pull request #3796 from nateprewitt/https_doc_fix
updating https demo urls
2017-01-05 01:17:22 -05:00
Nate Prewitt
f5c5536916 updating https demo urls 2017-01-04 15:23:23 -07:00
Cory Benfield
edf09ada17 Merge pull request #3795 from AdamWill/tests-require-pytest-mock
Require pytest-mock for the tests
2016-12-30 18:14:59 +00:00
Adam Williamson
33b29be8cf Require pytest-mock for the tests
test_requests.py `test_session_close_proxy_clear` uses the
`mocker` fixture, which is provided by pytest-mock.
2016-12-30 09:40:12 -08:00
Cory Benfield
b9d282b6b7 Merge pull request #3791 from evgen231/master
Fixed detection of utf-32-be by BOM.
2016-12-29 09:41:23 +00:00
Герасименко Евгений
0cb6ddaecf Fixed tests for python 2.x. 2016-12-29 10:30:56 +07:00
Герасименко Евгений
1c34ac3ae6 Fixed detection of utf-32-be by BOM. 2016-12-29 10:21:32 +07:00
Kenneth Reitz
8e0a532cad wonder when 3.6 will be available on travis 2016-12-23 13:08:52 -05:00
John Dingee
5aa6661587 fix urllib3 documentation link (#3785) 2016-12-21 13:08:45 -05:00
Marcin Płonka
bc8b29099e updating idna.uts46data from upstream project (#3781)
* updating idna.uts46data from upstream project

* removing redundant find/sed in idna update

* Revert "updating idna.uts46data from upstream project"

This reverts commit 0150cee7057dbdcefa1a2fbe2e8617ad0cba5216.
2016-12-21 10:59:34 -05:00
Kenneth Reitz
c3fb8e020b we support python 3.6 2016-12-20 13:25:30 -05:00
Kenneth Reitz
789f21807d python 2.6 compatibiliby 2016-12-20 13:16:14 -05:00
Kenneth Reitz
ba6e948835 skipping pypy for now 2016-12-20 13:10:45 -05:00
Kenneth Reitz
ddde5cd85b travis and saythanks icons in readme 2016-12-20 12:54:00 -05:00
Kenneth Reitz
5a280a11bc we don't support python 3.2 2016-12-20 12:50:22 -05:00
Kenneth Reitz
daebd6b807 empty commit 2016-12-20 12:47:39 -05:00
Kenneth Reitz
e127ecab3f add pypy to travis.yml 2016-12-20 12:42:52 -05:00
Kenneth Reitz
30bcd55fb9 basic travis.yml file 2016-12-20 12:41:47 -05:00
Cory Benfield
1285f576ae v2.12.4 2016-12-14 11:37:52 +00:00
Cory Benfield
9726f5314e Merge pull request #3766 from nateprewitt/1979_test_401
testing HTTPDigestAuth hooks
2016-12-14 09:41:11 +00:00
Nate Prewitt
1da1213561 add socket tests for 401 redirect and 401 failure 2016-12-13 14:43:16 -07:00
Cory Benfield
4683f16990 Merge pull request #3760 from sigmavirus24/deprecation-warning
Add deprecation warnings for 3.0
2016-12-09 14:48:42 +00:00
Ian Cordasco
fae6701478 Add deprecation warnings for 3.0
Add extra test parameter for basic auth encoding
2016-12-09 08:43:54 -06:00
Cory Benfield
449d74842d Merge pull request #3758 from nateprewitt/3753_allow_non_string_params_basic_auth
adding string casting for non-bytes values
2016-12-09 08:45:14 +00:00
Nate Prewitt
576b447a37 adding string casting for non-bytes values 2016-12-08 21:13:14 -07:00
Cory Benfield
11a86a5651 Merge pull request #3754 from nateprewitt/3066_auth_and_data
test auth doesn't generate incorrect http headers
2016-12-08 09:05:12 +00:00
Nate Prewitt
13716728e7 minor doc string cleanup 2016-12-04 12:11:09 -07:00
Casey Davidson
14d71fd41a Test chunked upload doesn't set content length 2016-12-04 12:01:07 -07:00
Casey Davidson
2d2c831d07 Add tests to verify that correct 'Content-Length' or 'Transfer-Encoding' headers are being set in PreparedRequest. 2016-12-04 12:00:57 -07:00
Cory Benfield
c398ab0e7d v2.12.3 2016-12-01 10:48:35 +00:00
Cory Benfield
7d2dfa8684 Merge pull request #3738 from Lukasa/revert-exclusion-patch
Revert "Restrict URL preparation to HTTP/HTTPS"
2016-12-01 10:45:25 +00:00
Cory Benfield
6f659a4179 Tests for our URL handling. 2016-11-30 21:45:09 +00:00
Cory Benfield
402a55b647 Revert "Restrict URL preparation to HTTP/HTTPS"
This reverts commit 34af72c87d.
2016-11-30 21:19:31 +00:00
Cory Benfield
ca15d48087 v2.12.2 2016-11-30 12:38:26 +00:00
Cory Benfield
5c4549493b Merge pull request #3695 from nateprewitt/idna_bypass
idna bypass
2016-11-25 13:18:01 +00:00
Cory Benfield
36c9c8c3de Merge pull request #3718 from nsoranzo/master
Make Response.content() return None for an empty response
2016-11-24 13:35:37 +00:00
Nicola Soranzo
f897be58bf Make Response.content return None if raw is None
Add test.
2016-11-24 12:54:26 +00:00
Kenneth Reitz
dfad00a6e8 Update README.rst 2016-11-23 20:10:44 -05:00
Kenneth Reitz
d5e050da85 Update README.rst 2016-11-23 20:10:04 -05:00
Kenneth Reitz
1ec08bedd4 links 2016-11-23 20:00:33 -05:00
Kenneth Reitz
724ae1274e new logo :D
https://kennethreitz.org/tattoos
2016-11-23 19:58:18 -05:00
Nicola Soranzo
4f428228d7 Make Response.content() return None if status_code is None
Fix #3698.
2016-11-23 21:15:07 +00:00
Cory Benfield
ccabcf1fca Merge pull request #3717 from nateprewitt/streaming_docs
streaming doc clarification
2016-11-23 10:17:31 +00:00
Nate Prewitt
4f9d0e0455 streaming doc clarification 2016-11-21 14:17:28 -07:00
Cory Benfield
b9f1c448f7 Merge pull request #3673 from klimenko-forks/auth-unicode
Enable unicode in basic http auth
2016-11-21 19:27:39 +00:00
Cory Benfield
22ec73d71a Merge pull request #3713 from tiran/strict_http_protocol_check
Restrict URL preparation to HTTP/HTTPS
2016-11-21 19:13:56 +00:00
Dmitry Klimenko
005f93fd0f added new test, original test restored 2016-11-21 21:42:44 +03:00
Christian Heimes
34af72c87d Restrict URL preparation to HTTP/HTTPS
Requests treats all URLs starting with the string 'http' as HTTP URLs.
Preparation with IDNA breaks non-standard URIs like http+unix. Requests
now prepares only URLs with prefix http:// and https://.

Signed-off-by: Christian Heimes <christian@python.org>
2016-11-21 18:46:57 +01:00
Nate Prewitt
a83685ce00 modifying IDNA encoding check to allow fallback 2016-11-21 08:22:42 -07:00
Nate Prewitt
264f5bd5e1 adding unicode_is_ascii utility function 2016-11-21 08:22:41 -07:00
Nate Prewitt
d52e9b8c80 updated tests with IDNA encoded and IPv6 urls 2016-11-21 08:22:37 -07:00
Kenneth Reitz
268672ab33 Update sidebarlogo.html 2016-11-20 22:49:17 -05:00
Kenneth Reitz
3b956495c1 Update sidebarintro.html 2016-11-20 22:48:43 -05:00
Dmitry Klimenko
3b84be3c99 changed behavior of basic-http-auth test 2016-11-18 20:39:55 +03:00
Dmitry Klimenko
e15280e49d fixed: httpbin with unicode auth 2016-11-18 19:04:51 +03:00
Dmitry Klimenko
55dea233ce fixed some error 2016-11-18 15:19:43 +03:00
Dmitry Klimenko
4f0efdb77e unicode test for _basic_auth_str 2016-11-18 13:31:31 +03:00
Dmitry Klimenko
7c4821231f Fixed: httpbin doesn't support bytes 2016-11-18 13:14:08 +03:00
Dmitry Klimenko
bf3e960e15 fixed usage unicode string 2016-11-17 23:13:03 +03:00
Cory Benfield
53d4a1feee Merge pull request #3704 from afeld/patch-1
clarify that the `chunk_size` is optional when streaming to a file
2016-11-17 17:27:47 +00:00
Aidan Feldman
ed3ba3dbb8 correct backtick formatting 2016-11-17 12:26:19 -05:00
Dmitry Klimenko
37bde4b638 added unicode auth test 2016-11-17 20:22:32 +03:00
Aidan Feldman
5562c0f097 clarify that the chunk_size is optional when streaming to a file 2016-11-17 12:21:58 -05:00
Dmitry Klimenko
2185fac626 remove extra import 2016-11-17 19:52:13 +03:00
Dmitry Klimenko
329a5cfdd4 Order of type check 2016-11-17 19:50:53 +03:00
Kenneth Reitz
5b66b364a7 Merge pull request #3703 from kennethreitz/revert-3700-master
Revert "Adding 'import requests' to readme code snippet."
2016-11-17 10:53:38 -05:00
Kenneth Reitz
5f4d0d08de Revert "Adding 'import requests' to readme code snippet." 2016-11-17 10:53:33 -05:00
Rakib Hasan
7e138f945e Adding 'import requests' to readme code snippet. (#3700)
* added import requests to small demo
2016-11-17 08:23:57 +00:00
Cory Benfield
1e198f9115 Merge pull request #3697 from hussaintamboli/master
Fixed issue #3696. Added a test for it as well.
2016-11-16 18:32:59 +00:00
Hussain
be8b13e89b Added myself to AUTHORS 2016-11-16 23:33:42 +05:30
Hussain
0d7de50dbd Just lstrip instead of strip because trailing whitespace already works. 2016-11-16 23:26:48 +05:30
Hussain
248d3e9f0f Fixed issue #3696. Added a test for it as well. 2016-11-16 22:48:45 +05:30
Cory Benfield
eb39a557bd v2.12.1 2016-11-16 10:44:29 +00:00
Cory Benfield
e7a6893282 Merge pull request #3694 from Lukasa/prepare-1.19.1
Prepare 2.12.1
2016-11-16 10:44:02 +00:00
Cory Benfield
c2688bbf27 Add changelog for 1.19.1 2016-11-16 10:35:14 +00:00
Cory Benfield
e1b5e19c78 Update bundled urllib3 to 1.19.1 2016-11-16 10:34:08 +00:00
Cory Benfield
7f2a4151f7 Merge pull request #3693 from Lukasa/setuptools-extra
Change setuptools extra for secure extra.
2016-11-16 10:33:47 +00:00
Cory Benfield
9ec3478469 Change setuptools extra for new secure extra. 2016-11-16 10:31:39 +00:00
Cory Benfield
341f288449 Merge pull request #3691 from Cleod9/readme-typo-domain-arg
Fixes small readme typo - site => domain
2016-11-16 08:39:06 +00:00
Cory Benfield
3ea3324434 Merge pull request #3690 from galgeek/clarify-allow_redirects
Clarify allow_redirects
2016-11-16 08:38:33 +00:00
Greg McLeod
b4d843bad2 Fixed readme typo - 'site' should be 'domain' 2016-11-15 22:27:45 -05:00
Barbara Miller
eaf9a688c5 Clarify allow_redirects
Make consistent with quickstart doc.
2016-11-15 18:59:05 -08:00
Cory Benfield
9a0a6cab55 Merge pull request #3688 from nateprewitt/release-docs-fix
spelling fix for release-process.rst
2016-11-15 20:30:21 +00:00
Nate Prewitt
87b7914bb2 spelling fix for release-process 2016-11-15 13:11:58 -07:00
Cory Benfield
512a78173a Merge pull request #3684 from nateprewitt/fixing_url_tests_without_method
Add method to url tests
2016-11-15 17:51:42 +00:00
Nate Prewitt
5bb01fbfe8 adding method to url tests 2016-11-15 10:46:10 -07:00
Cory Benfield
362da46e9a v2.12.0 2016-11-15 10:30:17 +00:00
Cory Benfield
2d211d59a0 Fix tests for new urllib3 exception text. 2016-11-15 10:22:38 +00:00
Cory Benfield
72d69d7b62 Update certifi certs to 2016.09.26 2016-11-15 10:11:58 +00:00
Cory Benfield
99fa7becf2 Update urllib3 to 1.19 2016-11-15 10:09:11 +00:00
Cory Benfield
e2408fce9d Merge pull request #3679 from mlissner/patch-2
Amplifies the timeout warning in the docs.
2016-11-14 17:58:13 +00:00
Mike Lissner
cfb7fd8f28 Amplifies the timeout warning in the docs.
Partially addresses #3070.
2016-11-14 09:57:08 -08:00
Cory Benfield
33bd38be15 Merge pull request #3678 from nateprewitt/3675_streaming_docs
decoding fix for Streaming Requests docs
2016-11-14 16:55:33 +00:00
Nate Prewitt
d81ad06c64 documentation on encoding fallback for streaming 2016-11-14 09:52:40 -07:00
Nate Prewitt
71b8941f0e adding decoding requirement for Python 3 2016-11-14 09:43:19 -07:00
Dmitry Klimenko
e514920e19 Unable unicode in basic http auth
Fixed the issue with unicode characters in basic http auth
2016-11-12 01:39:37 +03:00
Kenneth Reitz
70f1f8ed35 Merge pull request #3671 from chris-martin/json-ValueError
Document that Response.json() may raise ValueError
2016-11-10 18:18:16 -05:00
Chris Martin
a49c387b7a Document that Response.json() may raise ValueError 2016-11-10 16:26:07 -05:00
Cory Benfield
d24da4a953 Merge pull request #3489 from nateprewitt/1558_pickling_prepared_request
adding in pickling tests for PreparedRequest
2016-11-10 17:26:47 +00:00
Nate Prewitt
340902153f updating pickling tests for PreparedRequest 2016-11-04 10:56:13 -06:00
Cory Benfield
80634b2fad Merge pull request #3666 from hootnot/doc-patch
documentation line added for consistency with the post method
2016-11-03 10:39:47 +00:00
Cory Benfield
f72684e13c Merge pull request #3655 from nateprewitt/tzickel_post_redirect_w_streamable
Rewind readable body before POST redirect
2016-11-03 10:31:04 +00:00
hootnot
623d9e7878 documentation line added for consistency with the post method 2016-11-03 11:10:59 +01:00
Cory Benfield
87e40d116f Merge pull request #3663 from nateprewitt/fix_cookiejar_from_dict_docs_path
fix path for cookiejar_from_dict in api.rst
2016-11-03 10:06:53 +00:00
Nate Prewitt
b5ca0c8d58 correct module for cookiejar_from_dict in docs 2016-11-02 14:59:08 -06:00
Nate Prewitt
522d37c959 update 307 tests to check body content 2016-11-02 12:04:44 -06:00
tzickel
38dd089c5f Test case for requests getting stuck on post redirect with seekable stream 2016-11-02 12:03:19 -06:00
Nate Prewitt
9849c27b70 test _body_position and rewind_body 2016-11-02 10:12:22 -06:00
Nate Prewitt
40402cd0dd adding rewind for re-POST bodies 2016-11-02 09:56:56 -06:00
Cory Benfield
bf19750c0a Merge pull request #3660 from pawelmhm/proxy_empty_pass
[httpAdapter] allow empty password in proxy credentials
2016-10-31 13:59:16 +00:00
Pawel Miech
c97a530638 [httpAdapter] allow empty password in proxy credentials
fixes #3659
2016-10-31 14:42:01 +01:00
Cory Benfield
7eaa5ee37f Merge pull request #3658 from elzapp/patch-1
Formatted the example to fix the color highlighting
2016-10-31 08:53:04 +00:00
Bård Aase
388e949e83 Formatted the example to fix the color highlighting 2016-10-31 09:09:16 +01:00
Cory Benfield
595a409a18 Merge pull request #3627 from nateprewitt/remove_update_call
remove RequestsCookieJar specific update call
2016-10-27 20:53:18 +01:00
Nate Prewitt
390a499e81 test different CookieJar types for add_dict_to_cookiejar 2016-10-27 13:22:45 -06:00
Nate Prewitt
dfd85f2099 make add_dict_to_cookiejar cookielib.CookieJar compatible 2016-10-27 13:17:41 -06:00
Ian Cordasco
9deb603dc3 Merge pull request #3652 from gardiac2002/master
The data= parameter barfs on all dictionary-like objects that don't subclass dict itself #3649
2016-10-27 11:51:29 -05:00
Philipp Konrad
548a03acef requests.post checked data parameters for type like dict.
Changed the type check to Mapping.
2016-10-27 17:57:09 +02:00
Cory Benfield
50486cf2be Merge pull request #3620 from Lukasa/better-idna
Better support for internationalized domain names.
2016-10-21 13:09:04 +01:00
Cory Benfield
d14401f799 Merge pull request #3631 from lovedboy/master
little modification  in consume_socket_content
2016-10-21 09:58:30 +01:00
lovedboy
d587533446 little modification in consume_socket_content 2016-10-21 16:55:58 +08:00
Cory Benfield
83fcabc5bd Merge pull request #3625 from mie00/tellioerror
fix issue when the file-like object raises an IOError with tell
2016-10-21 08:20:37 +01:00
Cory Benfield
e7f5bd634d Check in updated idna. 2016-10-19 13:19:50 +01:00
Cory Benfield
41b4658738 Further complicate the makefile to rewrite imports 2016-10-19 13:19:37 +01:00
Mohamed Elawadi
f5b5c293b9 fix issue when the file-like object raises an IOError with tell 2016-10-18 11:09:25 +02:00
Ian Cordasco
b8f4c7c7ff Merge pull request #3621 from Lukasa/fix-packaging
Add a missing backport.
2016-10-14 11:38:33 -05:00
Ian Cordasco
c13e313f5a Merge pull request #3622 from Lukasa/better-makefile
Update makefile to only ship tagged releases.
2016-10-14 11:38:17 -05:00
Cory Benfield
8dd51d22fc Enable UTS46 mode. 2016-10-14 15:13:37 +01:00
Cory Benfield
ae82300073 We only ship tagged releases now. 2016-10-14 11:06:25 +01:00
Cory Benfield
f19d30a670 Seems like we're missing a backport here. 2016-10-14 10:58:26 +01:00
Cory Benfield
110684ea02 Changelog entry for better IDNA. 2016-10-14 10:54:55 +01:00
Cory Benfield
9337b4d95d Basic tests for internationalized domain names. 2016-10-14 10:53:15 +01:00
Cory Benfield
49b69b57db Various packaging requirements for idna 2016-10-14 10:21:24 +01:00
Cory Benfield
27812eb902 Use IDNA2008 to encode hosts. 2016-10-14 10:17:52 +01:00
Cory Benfield
35056b1de6 Add license for idna package. 2016-10-14 10:12:16 +01:00
Cory Benfield
3c680cc1c6 Vendor idna v2.1 2016-10-14 10:10:54 +01:00
Cory Benfield
dfb4ef7be0 Add makefile to get latest idna release. 2016-10-14 10:10:17 +01:00
Ian Cordasco
8f37cf79c3 Merge pull request #3617 from Lukasa/jeremycline
Note that @jeremycline is now our contact.
2016-10-13 09:08:10 -05:00
Cory Benfield
45478d5be1 Note @jeremycline is now our contact. 2016-10-13 13:28:19 +01:00
Cory Benfield
d0f7a51dd8 Merge branch 'TetraEtc-docs-custom-verbs' 2016-10-12 11:11:17 +01:00
Cory Benfield
02ab1ba5bd Let's use capitals. 2016-10-12 11:11:05 +01:00
Stewart Polley
341bed9e17 Add Documentation for custom methods 2016-10-08 06:22:07 +10:00
Ian Cordasco
7322a09379 Merge pull request #3607 from frankier/dont-swallow-attributeerror
Remove error swallowing exception catching of AttributeError
2016-09-30 07:17:17 -05:00
Frankie Robertson
327512f5ef Remove error swallowing exception catching of AttributeError 2016-09-29 23:07:16 +09:00
Cory Benfield
022e23c977 Merge pull request #3606 from bbamsch/httpbinTestFix
Issue #3597 - Rework Bytestring Host Test to use PyTest Httpbin
2016-09-29 08:09:22 +01:00
Brian Bamsch
5c15fffaca Rework Bytestring Host Test to use PyTest Httpbin 2016-09-28 20:48:27 -07:00
Cory Benfield
1ac56f1343 Merge pull request #3604 from iamprakashom/master
fixes broken link on documentation page
2016-09-28 12:32:53 +01:00
Om Prakash
ed0570bc2b updates authors
updates AUTHORS for #3603
2016-09-28 16:38:51 +05:30
Om Prakash
06920cc266 fixes broken link on documentation page
Issue #3603
2016-09-28 16:34:02 +05:30
Cory Benfield
5eabcb7a2f Merge pull request #3598 from bbamsch/bytestringHostFix
Issue #3597 - Avoid bytestring/str hodgepodge when resolving cookie from Request URL
2016-09-28 08:56:38 +01:00
Brian Bamsch
087aeacee5 Change module of internal references to to_native_str() 2016-09-27 20:41:21 -07:00
Brian Bamsch
3ac70defff Update Comments & Magic Strings 2016-09-27 20:41:17 -07:00
Cory Benfield
9a0b392dee Merge pull request #3600 from frewsxcv/patch-1
Indicate shell command in HISTORY is code-like.
2016-09-27 08:06:27 +01:00
Brian Bamsch
f002b73026 Move to_native_string to _internal_utils.py to avoid circular dependency 2016-09-26 21:41:01 -07:00
Corey Farwell
ae83352bbd Indicate shell command in README is code-like. 2016-09-26 16:21:07 -04:00
Brian Bamsch
2af059797a Adjust patch to utilize requests utility functions
Use the utility class provided by requests to do native string
transformation rather than recreating the wheel.
2016-09-26 09:14:51 -07:00
Brian Bamsch
550dc19099 Add line to AUTHORS
Credit where credit is due 😄
2016-09-25 22:22:33 -07:00
Brian Bamsch
01e405c611 Add patch to avoid bytestring/str hodgepodge
When patching Host header into URL, verify that host type matches
urlparse return type before putting it all back together
2016-09-25 22:18:45 -07:00
Brian Bamsch
b28531f4bb Add test for request when Host header is bytestring
Request should successfully set cookie in response, fail if cookie fails
to set as will occur in current state when cookie set tries lookup of
domain
2016-09-25 22:10:57 -07:00
Cory Benfield
439451c3d4 Merge pull request #3591 from nateprewitt/3579_cookie_merge
Fix RequestsCookieJar specific update call
2016-09-23 10:32:51 +01:00
Ian Cordasco
9407d697c8 Merge pull request #3545 from nateprewitt/new_prepare_content_length
removing redundant logic from prepare_content_length
2016-09-22 07:49:57 -05:00
Nate Prewitt
31b35ab838 removing redundant logic from prepare_content_length 2016-09-21 16:37:28 -06:00
Nate Prewitt
08a158f486 converting update call to merge_cookies call for cookielib compatibility 2016-09-20 12:20:00 -06:00
Ian Cordasco
ddf7df9b00 Merge pull request #3576 from nateprewitt/3557_revert_and_fix_encoding
Fix encoding issue in test_response_reason_unicode_fallback
2016-09-20 09:48:40 -05:00
Cory Benfield
c12122970a Merge pull request #3580 from rbcarson/idna-thread-embedded-3578
Add workaround to avoid implicit import of encodings.idna. Fixes #3578.
2016-09-17 08:18:59 +01:00
Carson Lam
d7227fbb7e Add workaround to avoid implicit import of encodings.idna. 2016-09-17 00:12:36 -07:00
Cory Benfield
5524472cc7 Merge pull request #3535 from nateprewitt/3339_avoid_getvalues
avoid use of getvalues in super_len
2016-09-14 08:10:28 +01:00
Nate Prewitt
39e8c0d96f reverting 3357 and comparing properly encoded strings 2016-09-13 22:51:28 -06:00
Cory Benfield
2041adbe4d Merge pull request #3557 from sigmavirus24/fix-failing-test
Fix how we test fallback to latin-1 reason encoding
2016-09-06 15:58:02 +01:00
Ian Cordasco
42d4eaf6ea Fix how we test fallback to latin-1 reason encoding
This was terribly broken and found while merging master into proposed/3.0.0
2016-09-06 09:55:37 -05:00
Ian Cordasco
87f96936fe Merge pull request #3554 from nateprewitt/3538_fallback_to_ISO_8591_1
ISO-8859-1 fallback for reason decoding
2016-09-05 18:15:06 -05:00
Nate Prewitt
2e1086f5b4 adding comment 2016-09-05 14:17:46 -06:00
Ian Cordasco
39b3477726 Merge pull request #3552 from Trodis/master
pysocks 1.5.7 blacklisting, due to IPv6 problems
2016-09-05 11:47:13 -05:00
Ferhat
dedf9064c6 pysocks 1.5.7 blacklisting, due to IPv6 problems 2016-09-05 18:28:57 +02:00
Nate Prewitt
cd056cd621 adding ISO-8859-1 fallback for reason decoding 2016-09-02 11:37:48 -06:00
Cory Benfield
58d855e193 Merge pull request #3541 from RichieB2B/ncsc-nl/docufix
Specify self.cert is used for SSL client certificates
2016-08-26 10:02:21 -04:00
Richard van den Berg
80f304fd30 Specify self.cert is used for SSL client certificates 2016-08-26 15:17:31 +02:00
Cory Benfield
889f855581 Merge pull request #3539 from RichieB2B/ncsc-nl/docufix
Add persistent examples
2016-08-26 09:16:54 -04:00
Richard van den Berg
2cd05271be Add persistent examples 2016-08-26 09:43:11 +02:00
Nate Prewitt
f5c59743e7 adding tests for super_len conditional flow 2016-08-25 16:56:01 -06:00
Nate Prewitt
99364b6b0b removing use of seek to set total_length 2016-08-24 15:06:53 -06:00
Skipper Seabold
8873a09097 Fall back to streaming 2016-08-24 09:59:33 -06:00
Skipper Seabold
d4965a4ec6 Python 2 compatibility 2016-08-24 09:59:33 -06:00
Skipper Seabold
af7729f64a Use seek from end rather than getvalue 2016-08-24 09:59:28 -06:00
Cory Benfield
52b15f811f Merge pull request #3530 from shellhead/mixed-proxy-bug
Fixed another scheme proxy over "all" priority issue
2016-08-23 07:54:35 -04:00
Michael Hunsinger
7c80222afa Fixed another scheme proxy over "all" priority 2016-08-22 21:01:13 -06:00
Cory Benfield
3314259185 Merge pull request #3526 from shellhead/mixed-proxy-bug
Fixed bug to give scheme proxy priority over "all"
2016-08-21 18:17:31 -04:00
Michael Hunsinger
77b068bb9e Fixed bug to give scheme proxy priority over "all" 2016-08-21 10:59:33 -06:00
Keyan Pishdadian
647ed5b6de Add pickle test with hooks 2016-08-19 14:38:33 -06:00
Keyan Pishdadian
117813ee2e Add prepared request pickling tests 2016-08-19 14:37:26 -06:00
Cory Benfield
d3567aacc9 Merge pull request #3510 from nateprewitt/add_close_passthrough
adding passthrough in close() for non-urllib3-like Responses
2016-08-18 09:28:20 +01:00
Kenneth Reitz
33501c7ae8 Merge pull request #3520 from Brausepaul/master
Adding notes about Requests' timeout behavior
2016-08-17 17:30:27 -04:00
Kenneth Reitz
532756803d v2.11.1 2016-08-17 16:03:38 -04:00
Maik
b5fac31688 Changes to documentation based on comments and correction of list of authors. 2016-08-17 22:03:18 +02:00
Kenneth Reitz
04fdf1a25a Merge pull request #3514 from Lukasa/prepare-2.11.1
Prepare for 2.11.1 bugfix release.
2016-08-17 16:01:58 -04:00
Maik Himstedt
b26606cc3c Adding notes about Request's timeout behavior. 2016-08-17 20:27:00 +02:00
Brausepaul
13bc52f82c Merge pull request #1 from kennethreitz/master
Updating fork with updates from original repo
2016-08-17 19:24:02 +02:00
Kenneth Reitz
b9648bad19 Update index.rst 2016-08-15 15:36:41 -04:00
Kenneth Reitz
786fb19a6d Merge pull request #3513 from nateprewitt/doc_updates
doc updates
2016-08-15 13:52:56 -04:00
Cory Benfield
ab1a6a4d00 Prepare changelog for 2.11.1. 2016-08-15 10:05:37 +01:00
Nate Prewitt
1435cf5aff docs updates 2016-08-14 20:56:52 -06:00
Cory Benfield
f12166acb6 Merge pull request #3511 from forrestchang/master
fix grammer mistakes in Quickstart
2016-08-13 09:42:25 +01:00
Jiayuan Zhang
00f83fb0c6 fix grammer mistakes in Quickstart 2016-08-13 10:19:10 +08:00
Nate Prewitt
59f12c9669 adding passthrough in close() for non-urllib3-like Responses 2016-08-12 10:54:41 -06:00
Ian Cordasco
f5ff345c35 Merge pull request #3493 from nateprewitt/3490_drop_headers
#3490 removing Content-Type and Transfer-Encoding headers on redirect
2016-08-12 06:24:36 -05:00
Nate Prewitt
4d5091c287 building Response manually 2016-08-11 14:54:26 -06:00
Nate Prewitt
e50c61bc86 removing Content-Type and Transfer-Encoding headers on redirect 2016-08-11 10:58:20 -06:00
Kenneth Reitz
c1d7d23b74 Merge pull request #3492 from nateprewitt/update_HISTORY
updating HISTORY
2016-08-09 17:16:37 -04:00
Nate Prewitt
10bc2f05d3 updating HISTORY 2016-08-09 15:12:34 -06:00
Cory Benfield
e4b7040530 Merge pull request #3487 from drpoggi/patch-1
Update README.rst
2016-08-09 16:40:20 +01:00
David Poggi
1e253cd0b3 Update README.rst 2016-08-09 11:14:40 -04:00
Cory Benfield
5e4abfa3a2 Merge pull request #3486 from nateprewitt/3481_revert_3362
reverting 3362
2016-08-09 14:52:22 +01:00
Nate Prewitt
d7f56ba938 reverting 3362 2016-08-09 07:36:39 -06:00
Cory Benfield
5259b37451 Merge pull request #3484 from scop/rtypes
Document bunch of return types
2016-08-09 11:42:45 +01:00
Ville Skyttä
542fbbc67f Document bunch of return types 2016-08-09 13:32:56 +03:00
Kenneth Reitz
931397829e Update index.rst 2016-08-08 23:01:48 -04:00
Kenneth Reitz
64c9451657 Merge pull request #3480 from drpoggi/patch-1
Clarify Python versions supported by requests
2016-08-08 23:00:55 -04:00
David Poggi
5f7b8ab0a7 Update index.rst 2016-08-08 22:58:26 -04:00
David Poggi
33a74f1787 Update index.rst
Range formatting update.
2016-08-08 22:57:05 -04:00
David Poggi
bab4aa0fbf Clarify Python versions supported by requests 2016-08-08 22:49:35 -04:00
Kenneth Reitz
57e7a308b0 Update HISTORY.rst 2016-08-08 17:35:40 -04:00
Kenneth Reitz
a2e41ba1f1 v2.11.0 2016-08-08 11:06:58 -04:00
Kenneth Reitz
05d90b9379 Merge pull request #3475 from Lukasa/prepare-2.11
Prepare for 2.11 release.
2016-08-08 11:05:02 -04:00
Cory Benfield
d7700bebeb Oh yeah, we updated urllib3 too. 2016-08-08 13:37:37 +01:00
Cory Benfield
c6eea58081 Changelog for 2.11 2016-08-08 13:37:09 +01:00
Cory Benfield
7bf67b4101 Update urllib3 to 1.16 2016-08-08 13:21:06 +01:00
Cory Benfield
cf7fdb901c Merge pull request #3469 from roselma/patch-1
Add a bit about RequestsCookieJar to Cookies section
2016-08-03 21:04:58 +01:00
Michael
07b7872df8 Add a bit about RequestsCookieJar to Cookies section 2016-08-03 13:03:34 -07:00
Cory Benfield
be12b27d71 Merge pull request #3462 from sigmavirus24/bug/3461
Close and then release the connection
2016-07-30 18:18:14 +01:00
Ian Cordasco
c69e3eed31 Close and then release the connection
urllib3 closes the underlying connection when we call
urllib3.Response.close but does not release it back to the connection
pool. This can cause issues when users have a blocking connection pool
configured and connections are not readily returned to the pool.

Since the underlying connection is closed, we should be able to safely
return the connection to the connection pool, so to fix this issue we
merely need to not return after closing the response.

Closes gh-3461
2016-07-30 07:16:18 -05:00
Ian Cordasco
f40764c01b Merge pull request #3441 from scop/spelling
Spelling fixes
2016-07-26 07:26:18 -05:00
Ville Skyttä
5453b88f8f Spelling fixes 2016-07-26 15:24:29 +03:00
Kenneth Reitz
fb01456061 Merge pull request #3429 from nateprewitt/docstring_cleanup
Docstring cleanup
2016-07-20 18:38:38 -04:00
Nate Prewitt
b7809acb47 making class and function docstrings consistent 2016-07-20 11:43:47 -06:00
Kenneth Reitz
4285bac3fd Merge pull request #3428 from nateprewitt/pep8_fixes
adding in pep8 fixes
2016-07-20 12:47:00 -04:00
Nate Prewitt
2d4a89f5dc adding in pep8 fixes 2016-07-20 10:30:08 -06:00
Nate Prewitt
15a3869006 making module docstrings and coding comments consistent 2016-07-19 14:51:14 -06:00
Cory Benfield
75d72ca4ea Merge pull request #3415 from nateprewitt/test_cleanup
removing redundant test
2016-07-15 08:07:44 +01:00
Nate Prewitt
d262df99bf removing redundant test 2016-07-14 21:53:10 -06:00
Cory Benfield
d7fc5d5296 Merge pull request #3402 from HarrisonJackson/remove-extra-warnings-import
Remove duplicate import warnings
2016-07-14 17:59:51 +01:00
Harrison Jackson
5a3aeedd18 Remove duplicate import warnings 2016-07-14 09:47:27 -06:00
Cory Benfield
6e54fd607f Merge pull request #3401 from Zeusw/patch-1
in python3.x not have StringIO
2016-07-14 08:57:49 +01:00
Zeusw
cf938420f8 in python3.x not have StringIO
I think, should such an amendment.
2016-07-14 10:40:32 +08:00
Cory Benfield
425962cb13 Merge pull request #3390 from nateprewitt/3386_header_value_type
Defining header value type requirements and tests
2016-07-07 17:20:03 +01:00
Ian Cordasco
5d9b9ffab4 Merge pull request #3388 from nateprewitt/header_doc_update
updating documentation to reflect decision of #3386
2016-07-07 09:56:08 -05:00
Nate Prewitt
1cb3b797fe updating documentation to reflect decision of #3386 2016-07-07 07:44:20 -06:00
Nate Prewitt
be31a90906 Defining header value type requirements and tests 2016-07-05 17:32:05 -06:00
Andrii Kostenko
7700ecae14 Support responses like HTTP/1.1 404 Unicode chars (#3385) 2016-07-05 09:01:19 -05:00
Nate Prewitt
71050e9ab9 adding in slice_length fix and test for chunk_size=None (#3370) 2016-07-02 15:56:20 -05:00
Cory Benfield
bd9e8f2271 Merge pull request #3366 from nateprewitt/2947-no-returns-in-header
check for headers containing return characters
2016-07-02 20:32:17 +01:00
Nate Prewitt
2669ab797c check and test for headers containing return characters or leading whitespace 2016-07-02 13:10:47 -06:00
Cory Benfield
ebadf81723 Merge pull request #3382 from nateprewitt/iter_content_docstring
updating iter_content docstring to match functionality
2016-07-02 19:10:20 +01:00
Nate Prewitt
0c08ca7154 updating docstring to match functionality 2016-07-02 08:43:23 -06:00
Joy Zheng
0bcf634135 Allow None value for chunk_size again (#3368) 2016-06-30 19:11:01 -05:00
Nate Prewitt
92fe51c0af adding asserted_encoding check on None type encoding to match text() behavior (#3362) 2016-06-28 14:22:00 -05:00
Cory Benfield
36453b95b1 Merge pull request #3365 from nateprewitt/3364_chunking_is_int
added in type check for chunk_size
2016-06-28 08:33:29 +01:00
Nate Prewitt
cf3c99890d added in type check for chunk_size 2016-06-27 19:58:15 -06:00
Cory Benfield
1f681d8843 Merge pull request #3358 from petedmarsh/master
Update list of supported Python versions in todo.rst
2016-06-21 19:53:19 +01:00
Peter Marsh
8484144c67 Update list of supported Python versions in todo.rst 2016-06-21 19:50:11 +01:00
Kenneth Reitz
771ecd7efd Merge pull request #3236 from eriol/xfail-test
Use xfail marker for a test expected to fail without Internet connection
2016-06-20 22:17:23 -04:00
John Vandenberg
400d27f982 Test security warnings (#3289)
Verify that the expected warnings are emitted
with SubjectAltNameWarning emitted on all environments
due to the https server provided by httpbin_secure.
2016-06-17 08:00:05 -05:00
Kenneth Reitz
e12ee9407c Merge pull request #3297 from davidfischer/http-error-specifics
Note how HTTPErrors are raised
2016-06-08 23:57:44 -07:00
Kenneth Reitz
6c9a0eff04 compensate for lack of taste 2016-06-09 00:38:53 -04:00
Kenneth Reitz
7d0a94d8c6 Merge pull request #3298 from davidfischer/appengine-notes
Update a note on AppEngine
2016-06-08 19:49:06 -07:00
David Fischer
6f5b6bd4c4 Update a note on AppEngine 2016-06-08 19:31:32 -07:00
David Fischer
277d4a41ad Note how HTTPErrors are raised 2016-06-08 18:19:10 -07:00
Cory Benfield
7a404cf4ec Document header ordering. (#3295) 2016-06-08 11:44:33 -05:00
Kenneth Reitz
8813787a12 wildly inaccurate button results in deletion
(not the button's fault!)
2016-06-04 22:08:47 -04:00
Cory Benfield
bca205e9bf Merge pull request #3251 from sigmavirus24/bug/3250
Update documentation of Session.max_redirects
2016-06-01 11:08:39 -07:00
Ian Cordasco
de4c75bbad Update documentation of Session.max_redirects
Fixes #3250
2016-06-01 11:00:42 -05:00
Daniele Tricoli
5e86103387 Use xfail marker for a test expected to fail without Internet connection
This is only a minor improvement on the great work of
https://github.com/kennethreitz/requests/pull/2859 that permits to run
tests on hosts without Internet connection.
2016-05-29 20:47:41 +02:00
Seppo Yli-Olli
9e9d2c6521 Make BaseAdapter describe the mandatory adapter interface (#3216)
* BaseAdapter definition of send is missing mandatory params

* Copy over relevant parts of the interface documentation

* Indentation fix

* Change base class documentation for close
2016-05-24 13:23:16 -05:00
Cory Benfield
49b69c4751 Merge pull request #3178 from haikuginger/master
Encoding JSON requests to bytes for urllib3 to handle
2016-05-22 17:02:09 +01:00
Brett Higgins
b6d6894f53 Allow graceful interruption of testserver.Server
So that failing tests don't cause the server thread to hang
indefinitely, waiting for connections that will never come.

Rationale for suppressing error/traceback from interrupted
_accept_connection in testserver.Server:
https://gist.github.com/brettdh/b6e741227b2297f19d2118077f14dfa5

* Move server socket close to just before join

This way it handles the no-connections, no-exceptions case
as well as the exception case. If the server thread doesn't
exit by itself within 5 seconds of the context manager exit,
the accept will be interrupted.

* Address feedback

- pytest.raises rather than except:pass
- Move socket create/bind back to run()
- Timeout on accepting connections
2016-05-17 10:45:12 -05:00
Ian Cordasco
cd4e6b9aef Merge pull request #3185 from brettdh/3183-support-all-proxy-env-var
Support ALL_PROXY environment variable
2016-05-17 10:42:31 -05:00
Brett Higgins
35744c3e5d Use iter instead of noop list comprehension 2016-05-16 21:53:20 -04:00
Ian Cordasco
12e3631827 Merge pull request #3195 from kumarvaradarajulu/no_proxy_fix
Fix to check for Plain ip notations in no_proxy settings if not CIDR
2016-05-16 07:47:33 -05:00
Kumar Varadarajulu
b94decc47c Combined tests to one tests for should_bypass_proxies method 2016-05-16 10:49:37 +00:00
Kumar Varadarajulu
f59a95713e Added tests for should_bypass_proxies function 2016-05-16 10:40:22 +00:00
Kumar Varadarajulu
17b6c5742c consider plain ip notation of an ip in no_proxy if not in cidr notation 2016-05-16 06:11:25 +00:00
Brett Higgins
4bf8866172 Add 'all' proxy selection to select_proxy
It seems it's necessary both in pulling all_proxy from the environment
(rebuild_proxies) and deciding which proxy to use (select_proxy).

Also added new functional test.
2016-05-13 15:30:38 -04:00
Ian Cordasco
4865f0f9bf Merge pull request #3188 from Lukasa/fixup-indentation
Replace tab with appropriate spaces.
2016-05-12 08:11:19 -05:00
Cory Benfield
0838685dab Replace tab with appropriate spaces. 2016-05-12 10:57:52 +01:00
Brett Higgins
1121f8b915 Support ALL_PROXY environment variable
Closes #3183.
2016-05-11 10:37:53 -04:00
Cory Benfield
87704105af Merge pull request #3179 from messense/messense-patch-1
Fix TypeError when get json-encoded content of a response
2016-05-06 13:59:01 +01:00
messense
cb4c2c0b65 Fix TypeError when get json-encoded content of a response
``self.content`` could be ``None``, so ``len(self.content)`` may raise ``TypeError: object of type 'NoneType' has no len()``
2016-05-06 09:53:14 +08:00
Ian Cordasco
3669b4216a Merge pull request #3173 from Lukasa/socks-proxy-docs
Add section on SOCKS proxies.
2016-05-05 12:18:27 -05:00
Jesse Shapiro
04bb965c87 Fixing test; it was accomplishing the right thing, but doing it in the wrong way. 2016-05-05 12:23:59 -04:00
Jesse Shapiro
52c0daff5f Cleaning up comment on JSON encoding to be more strictly relevant. 2016-05-05 12:12:49 -04:00
Jesse Shapiro
9ff2e43cd6 Removing charset from JSON content type; tightening requirements on .encode() 2016-05-05 06:27:12 -04:00
Jesse Shapiro
386382b18c Encoding JSON requests to bytes for urllib3 to handle; ensuring same with testing. 2016-05-04 20:09:07 -04:00
Cory Benfield
989e8f15dd Merge pull request #3171 from luv/master
docs: Add a note about SSL c_rehash
2016-05-03 08:44:42 +01:00
Cory Benfield
339e950dc7 Add section on SOCKS proxies. 2016-05-03 08:07:30 +01:00
Lukas Vacek
52facb2257 docs: Add a note about SSL c_rehash 2016-05-02 23:03:35 +02:00
Kenneth Reitz
296928f36f fixed date formatting 2016-04-29 18:17:21 -04:00
Kenneth Reitz
efb4af0127 v2.10.0 2016-04-29 18:11:49 -04:00
Kenneth Reitz
f69d8c16ed updated urllib3 (v1.15.1) 2016-04-29 18:11:17 -04:00
Kenneth Reitz
a5da4f399f v2.10.0 2016-04-29 18:03:28 -04:00
Kenneth Reitz
39d6935488 Merge pull request #2953 from Lukasa/socks_proxy_support
SOCKS Proxy Support
2016-04-29 18:03:04 -04:00
Kenneth Reitz
c9ef5653cc v2.9.2 2016-04-29 17:56:42 -04:00
Kenneth Reitz
2824867412 v2.9.2 2016-04-29 17:52:19 -04:00
Kenneth Reitz
f803dc6c99 updated authors 2016-04-29 17:52:11 -04:00
Kenneth Reitz
ce5e312593 Merge pull request #3096 from piotrjurkiewicz/master
Change _store of CaseInsensitiveDict to OrderedDict
2016-04-29 17:47:35 -04:00
Ian Cordasco
ecebf337ed Merge pull request #3139 from markshannon/fix/3138
Initialize hash_utf8 to None, preventing NameError. Fixes #3138.
2016-04-29 11:05:19 -05:00
Mark Shannon
abe02ed89f Initialize hash_utf8 to None, preventing NameError. Fixes #3138. 2016-04-29 16:49:24 +01:00
Cory Benfield
252bfa7885 Merge pull request #3136 from Natim/readthedocs.io
Update readthedocs links.
2016-04-28 11:43:14 +01:00
Rémy HUBSCHER
70a344d8eb Update readthedocs links. 2016-04-28 12:39:10 +02:00
Cory Benfield
343027893b Merge pull request #3132 from chipaca/no-hostname-no-cry
utils: let select_proxy not raise an exception when url has no hostname
2016-04-26 11:35:23 +01:00
John R. Lenton
4e7beef860 utils: let select_proxy not raise an exception when url has no hostname 2016-04-26 11:22:44 +01:00
Ian Cordasco
bbeb0001cd Merge pull request #3108 from kevinburke/flip-conditional
Flip conditional in session.send()
2016-04-21 10:30:22 -05:00
Kevin Burke
ae1ac2d4e0 Flip conditional in session.send()
Previously we checked that the `request` being sent was an instance of a
PreparedRequest. If a user somehow created a PreparedRequest using a different
Requests library instance, this check makes the request un-sendable.

(This happened recently - unbeknownst to me, my server was running an outdated
version of pip, vulnerable to this issue - pypa/pip#1489, which creates
multiple subdirectories (src/requests, src/requests/requests) when you rerun
pip install --target. So the PreparedRequest was being created in one version
of the library and compared against the other version of the library, and
throwing this exception, even though they were both PreparedRequest instances!)

It would probably be preferable to check the object's behavior (instead of
its type), but a PreparedRequest has a lot of behavior, and it wouldn't be
really feasible or allow us to provide a helpful error message to check all
of it here. Instead flip the conditional to guard against the user sending an
unprepared Request, which should still give us most of the benefits of the
better error message.

Fixes #3102
2016-04-21 08:12:05 -07:00
Kenneth Reitz
aa1c3adf9a Merge pull request #3100 from hitstergtd/hitstergtd-docfixes-1
Remove stale sentence in philosophy.rst
2016-04-17 13:26:24 -04:00
Piotr Jurkiewicz
b1a7dcd799 Fix test_headers_preserve_order 2016-04-16 22:21:10 +02:00
Hitster GTD
d801d7797e Remove stale sentence in philosophy.rst
Sentence contained reference to version 1.0.0.
2016-04-16 10:57:24 +01:00
Ian Cordasco
60aee145b9 Merge pull request #3091 from bodgit/proxy
Clear any pooled proxy connections
2016-04-15 07:50:06 -05:00
Matt Dainty
2029a8a931 Clear any pooled proxy connections
As well as clearing any pooled direct connections, iterate over any
ProxyManager objects and clear any pooled proxy connections there as well.
2016-04-15 09:33:37 +01:00
Piotr Jurkiewicz
c8a0fc6aa2 Use OrderedDict from .compat module 2016-04-15 04:43:53 +02:00
Piotr Jurkiewicz
4f5741e1ff Add test of headers order preservation 2016-04-15 00:35:57 +02:00
Piotr Jurkiewicz
4c04469cfb Change _store of CaseInsensitiveDict to OrderedDict 2016-04-14 18:10:50 +02:00
Kenneth Reitz
4a716e0dfc Merge pull request #2897 from BraulioVM/dummy-server
Test socket server
2016-04-11 16:29:02 -04:00
Braulio Valdivielso Martínez
634b2beb39 Fixed indenting issues 2016-04-11 20:03:23 +02:00
Ian Cordasco
e65d6fc637 Merge pull request #3082 from tzickel/master
Added a test to show a faulty behaviour when posting binary data for an object with no __iter__
2016-04-11 07:38:50 -05:00
Cory Benfield
b5d375417f Merge pull request #3086 from sleshep/master
add rtype in session.request,help pycharm easy.
2016-04-11 08:14:39 +01:00
liuyang
2981366f56 add rtype in session.request 2016-04-11 14:33:23 +08:00
Kenneth Reitz
2874fd18fe Merge pull request #3080 from Lukasa/rfc7838
Add 421 Misdirected Request.
2016-04-10 16:49:27 -04:00
tzickel
219490ea7f Make a dummy test 2016-04-08 23:17:37 +03:00
tzickel
fb230709a8 Fix for the test ? 2016-04-08 22:23:35 +03:00
tzickel
2246a52a36 Added a test to show a faulty behaviour when posting binary data for an object
with no __iter__
2016-04-08 20:25:01 +03:00
Cory Benfield
831d8e0a1e Add 421 Misdirected Request. 2016-04-08 08:23:46 +01:00
Kenneth Reitz
f0860bd3ca Merge pull request #3048 from Stranger6667/test-structures
Added unit tests for structures module
2016-04-06 15:06:36 -04:00
Kenneth Reitz
456be3cfde Merge pull request #3024 from Stranger6667/utils-unit-tests
Added unit tests for utils module
2016-04-06 15:05:13 -04:00
Kenneth Reitz
b6b1b3a81c Merge pull request #3049 from Stranger6667/test-hooks
Added unit tests for hooks module
2016-04-06 15:04:15 -04:00
Kenneth Reitz
90578795eb Update HISTORY.rst 2016-04-06 15:02:06 -04:00
Kenneth Reitz
03ed671a41 Merge pull request #3059 from alexanderad/proxy-connection-errors
Raise a ProxyError for proxy related connection issues
2016-04-06 15:01:25 -04:00
Cory Benfield
e576f98429 Merge pull request #3069 from achermes/master
Update docstring and API doc to document ability to add per-file headers in multipart POST
2016-03-29 12:31:57 +01:00
Alexander Hermes
b8a577050d Update docstring and API doc to document ability to add per-file headers in multipart POST
* Docstring only change - for the function itself cf. requests Issue #1640
2016-03-29 11:57:47 +01:00
Ian Cordasco
3acf3a7238 Merge pull request #3060 from benweatherman/master
Consolidate logic for changing method during redirects
2016-03-20 13:46:00 -05:00
Ben
f24d56a1ce Consolidate logic for changing method during redirects
I only moved the code into a function, there was no actual change to
the code. I added a few tests to ensure we're doing things correctly.

The real point of me doing this is to make it easier to bring back
`strict_mode` functionality. For you requests youngsters in the crowd,
`strict_mode` followed the spec for redirects meaning the method
wouldn't change to a GET. The current code follows the browser
convention of changing the method to a GET when doing a 302 redirect.
However, lots of servers want you to follow the standards (the nerve!)
so I'd like to override the logic. Now that the method changing logic
is in `rebuild_method`, I can simply override that function instead of
overriding the entire `resolve_redirects` function as suggested by
kennethreitz/requests#1325
2016-03-17 23:16:39 -05:00
Alexander Shchapov
6ca9d71bb5 Raise a ProxyError for proxy related connection issues. 2016-03-17 15:46:26 -04:00
Cory Benfield
c9f8414476 Merge pull request #3057 from kevinburke/secure-by-default
Clarify that SSL verification is on by default
2016-03-17 15:19:59 +00:00
Kevin Burke
e94c812c2d Clarify that SSL verification is on by default
Generally if a kwarg is present it indicates that an option other than the
default is being specified. Putting `verify=True` in the first code sample
for SSL confused me, because it seemed to indicate that you had to specify
`verify=True` to get SSL verification. The opposite is true; SSL verification
is turned on by default and you have to specify `verify=False` to opt out of
SSL verification.

Updates the docs to make this more clear. Furthermore, connections to
https://kennethreitz.com currently time out instead of presenting an invalid
certificate, so I replaced this domain with https://requestb.in, which presents
the same error message as is currently there.
2016-03-17 08:16:56 -07:00
Dmitry Dygalo
81dc9084b2 Added unit tests for structures module 2016-03-15 14:47:32 +01:00
Dmitry Dygalo
eddea4e914 Added unit tests for hooks module 2016-03-14 14:08:44 +01:00
Dmitry Dygalo
1eb153529a Merge remote-tracking branch 'upstream/master' into utils-unit-tests
Conflicts:
	tests/test_utils.py
2016-03-13 10:24:47 +01:00
Ian Cordasco
190cddd4ae Merge pull request #3036 from Lukasa/issue/3035
Allow for exceptions from tell()
2016-03-11 07:30:53 -06:00
Cory Benfield
90a166d44a Release note. 2016-03-11 09:57:59 +00:00
Kenneth Reitz
3a26d13b52 Merge pull request #3041 from bsandrow/patch-2
Fix autofunction Reference
2016-03-09 03:59:44 -05:00
Kenneth Reitz
fe475f5d46 Merge pull request #3042 from bsandrow/patch-1
Fix api.rst References
2016-03-09 00:35:45 -05:00
Brandon Sandrowicz
f0d5a1f230 Fix autofunction Reference
`request.codes` is a class (`LookupDict`), not a function.
2016-03-08 23:57:54 -05:00
Brandon Sandrowicz
ee060ba7f3 Fix api.rst References
api.rst references `requests.ConnectTimeout` and `requests.ReadTimeout`, but they aren't imported into the top-level of the package.
2016-03-08 23:51:46 -05:00
Braulio Valdivielso Martínez
b473440cc1 Fix tests in python 3 2016-03-07 18:33:06 +01:00
Cory Benfield
6cc0b56d51 Switch to treat files without tell() as zero-length 2016-03-07 09:05:43 +00:00
Cory Benfield
e034dd1140 Allow for exceptions from tell() 2016-03-07 08:31:23 +00:00
Cory Benfield
4f378b0e1a Merge pull request #3032 from davidsoncasey/master
Changes for #3028
2016-03-06 18:07:59 +00:00
Casey Davidson
f74a6707af Verify that cookie can be properly accessed if domain is specified, and that error is raised otherwise. Refs #3028. 2016-03-05 20:37:56 -08:00
Casey Davidson
c53a685e7d Fix typo. 2016-03-05 20:30:36 -08:00
Braulio Valdivielso Martínez
03743b15ed Added docstrings to tests in test_testserver.py 2016-03-05 23:50:11 +01:00
Braulio Valdivielso Martínez
0dff06a7b9 Add blank line in test_requests.py 2016-03-05 23:28:32 +01:00
Braulio Valdivielso Martínez
c4abb4c9fb Remove unwanted changes in test_utils.py 2016-03-05 23:26:36 +01:00
Braulio Valdivielso Martínez
94d4818fde Remove unwanted change in test_requests.py 2016-03-05 23:22:52 +01:00
Braulio Valdivielso Martínez
eeafdc143b Move test_chunked_upload to test_lowlevel.py 2016-03-05 23:21:00 +01:00
Braulio Valdivielso Martínez
66c52c3ce0 Leave two lines of separation between top level definitions 2016-03-05 23:11:31 +01:00
Braulio Valdivielso Martínez
3c3bde5381 Remove unwanted changes 2016-03-05 23:10:13 +01:00
Braulio Valdivielso Martínez
4edf1ae55f Compare response bodies with unicode strings 2016-03-05 23:05:36 +01:00
Braulio Valdivielso Martínez
7088c06d8d Changed tests to use socket.sendall instead of socket.send 2016-03-05 22:45:26 +01:00
Casey Davidson
b9517a58bc Assert that both cookies were added in test. Refs #3028. 2016-03-04 15:59:13 -08:00
Casey Davidson
d8b36c1718 Override __contains__ method of RequestsCookieJar to catch CookieConflictError. Refs #3028 2016-03-04 15:55:43 -08:00
Casey Davidson
1185d65202 Add tests to specify when CookieConflicError should be raised. References #3028. 2016-03-04 15:55:43 -08:00
Braulio Valdivielso Martínez
44161ac373 Moved TestTestServer to its own file 2016-03-04 19:35:46 +01:00
Braulio Valdivielso Martínez
0d1a779030 Fixed style issues 2016-03-04 19:33:58 +01:00
Braulio Valdivielso Martínez
bf026e3c31 Removed unittest execution chunk 2016-03-04 19:24:15 +01:00
Braulio Valdivielso Martínez
e3ad31f3be Added test_chunked_upload to test_requests.py 2016-03-04 19:21:32 +01:00
Braulio Valdivielso Martínez
f17ef753d2 Moved test_chunked_upload to test_requests.py 2016-03-03 22:13:47 +01:00
Braulio Valdivielso Martínez
567b31080e Fixed formatting error in python2.6 2016-03-03 22:00:27 +01:00
Braulio Valdivielso Martínez
75a9a981b5 Removed unnecessary files 2016-03-03 22:00:08 +01:00
Braulio Valdivielso Martínez
ca35c847a2 Moved testserver to tests/ 2016-03-03 21:52:59 +01:00
Braulio Valdivielso Martínez
141db281d1 Merged master 2016-03-03 21:44:21 +01:00
Braulio Valdivielso Martínez
9ac5a6e4ae Fixed encoding issues, added timeouts to event waits and refactored Server 2016-03-03 21:11:17 +01:00
Braulio Valdivielso Martínez
241656355b Changed whitespace in docstring 2016-03-03 20:09:13 +01:00
Braulio Valdivielso Martínez
fa91b0ab7c Fixed style 2016-03-03 20:07:42 +01:00
Kenneth Reitz
46184236dc docs2 2016-02-21 23:02:10 -05:00
Kenneth Reitz
7c5d703466 docs 2016-02-21 23:01:41 -05:00
Kenneth Reitz
f8798a253a http://pep8.org 2016-02-21 23:00:42 -05:00
Kenneth Reitz
7de1495bf5 add httpbin.org 2016-02-21 22:54:04 -05:00
Kenneth Reitz
c4adf614a6 translate all the pages 2016-02-21 22:35:38 -05:00
Kenneth Reitz
f90c311851 peeps be stealin'! 2016-02-21 22:04:52 -05:00
Kenneth Reitz
f2ec732ce8 stay informed 2016-02-21 20:45:45 -05:00
Kenneth Reitz
e47e80b92f &bsp; 2016-02-21 20:34:15 -05:00
Kenneth Reitz
5f06b8196e updated sidebars 2016-02-21 20:32:42 -05:00
Kenneth Reitz
41c26ce1f5 improvements to index 2016-02-21 20:32:36 -05:00
Kenneth Reitz
75096a167c transcendental meditation 2016-02-19 09:26:21 -05:00
Kenneth Reitz
b366ef039c improved presentation of style guide 2016-02-19 09:11:09 -05:00
Kenneth Reitz
fc1e9b46a1 lyrics, er, docstrings 2016-02-19 09:08:29 -05:00
Kenneth Reitz
a7b5e3191d pass go, yay $200 2016-02-19 08:51:36 -05:00
Kenneth Reitz
ca303cda0a letters 2016-02-19 06:14:51 -05:00
Kenneth Reitz
1b1f4ac77d cheat code 2016-02-19 06:08:38 -05:00
Kenneth Reitz
d8bf59dde4 namedrop 2016-02-19 05:45:55 -05:00
Kenneth Reitz
14a83339a7 words (docs) 2016-02-19 05:41:17 -05:00
Kenneth Reitz
b70136cf52 completely (docs) 2016-02-19 05:38:33 -05:00
Kenneth Reitz
f653b9ac58 sentences 2016-02-19 05:03:04 -05:00
Kenneth Reitz
1cf1699e37 what's docstrung 2016-02-19 04:56:25 -05:00
Kenneth Reitz
8dc5f68bc1 sp 2016-02-19 04:50:55 -05:00
Kenneth Reitz
29b191b5ea </tone> 2016-02-19 04:48:47 -05:00
Kenneth Reitz
ee024423a5 more pleasant wording about strong opinion 2016-02-19 04:44:11 -05:00
Kenneth Reitz
90ddeca70d updated style guide 2016-02-19 04:42:54 -05:00
Dmitry Dygalo
f123f89d32 Added unit tests for utils module 2016-02-19 10:32:23 +01:00
Kenneth Reitz
5d0ffd85ce style guide 2016-02-19 04:30:06 -05:00
Kenneth Reitz
2cb052aa95 sp 2016-02-19 04:11:41 -05:00
Kenneth Reitz
886f92324a contributing 2016-02-19 04:10:37 -05:00
Kenneth Reitz
d3bd9f30a6 contributing 2016-02-19 04:09:03 -05:00
Kenneth Reitz
688a00c386 improve contributions section 2016-02-19 03:47:12 -05:00
Kenneth Reitz
f63106005b better codeblocks on mobile 2016-02-19 02:59:05 -05:00
Kenneth Reitz
f8af499700 improve further advanced.rst 2016-02-19 02:45:07 -05:00
Kenneth Reitz
f4445b3d4f improve advanced.rst 2016-02-19 02:42:22 -05:00
Kenneth Reitz
bf8c8312dd cleanup quickstart 2016-02-19 02:12:15 -05:00
Kenneth Reitz
f4f863f168 cleanup advanced.rst
single-quoted strings, yo!
2016-02-19 02:06:33 -05:00
Kenneth Reitz
f422ace07e clean up codeblock styles 2016-02-19 01:52:59 -05:00
Kenneth Reitz
60b591eaac docs: widen things up 2016-02-19 01:47:54 -05:00
Kenneth Reitz
dbefff6821 sphinx is now working properly on RTD (grrrR) 2016-02-19 01:23:31 -05:00
Kenneth Reitz
e98d71de13 docs cleanup 2016-02-19 00:56:14 -05:00
Kenneth Reitz
45992769b2 +sphinx 2016-02-18 23:58:47 -05:00
Kenneth Reitz
47fa07dcd8 update requirements workflow 2016-02-18 23:57:30 -05:00
Kenneth Reitz
f6252c2203 improved installation instructions 2016-02-18 20:59:01 -05:00
Kenneth Reitz
c1c393122d change up marketing, update js/css 2016-02-18 20:41:04 -05:00
Kenneth Reitz
9f33a0cd3c refactor API documentation 2016-02-18 20:41:04 -05:00
Kenneth Reitz
b0704b86de years 2016-02-18 14:16:50 -05:00
Kenneth Reitz
057722af23 Update Makefile 2016-02-10 21:07:22 -05:00
Kenneth Reitz
169b7edcc3 Update README.rst 2016-02-07 11:51:23 -05:00
Kenneth Reitz
283491f8b6 Update Makefile 2016-02-07 10:58:30 -05:00
Kenneth Reitz
a3ded28c57 Update Makefile 2016-02-07 03:45:31 -05:00
Kenneth Reitz
2fa5fa6ac5 Update Makefile 2016-02-07 03:43:35 -05:00
Kenneth Reitz
476938ab8d Delete setup.cfg 2016-02-07 03:43:15 -05:00
Kenneth Reitz
3a77b59df2 Update index.rst 2016-02-05 18:08:48 -05:00
Kenneth Reitz
00c0a80e6b Update README.rst 2016-02-05 18:08:18 -05:00
Kenneth Reitz
087de5232c v2.9.2 in history 2016-02-05 17:53:18 -05:00
Kenneth Reitz
fc512d8924 Don't use redirect_cache if allow_redirects=False
Fix for #2997
2016-02-05 17:51:09 -05:00
Kenneth Reitz
bbadf47a8f syntax changes 2016-02-05 15:53:59 -05:00
Dmitry Dygalo
18b26d20f7 Added tests module. 2016-02-05 13:21:57 +01:00
Cory Benfield
6143b7eebc Merge pull request #2994 from Stranger6667/fix-bad-test
Fixed test execution.
2016-02-03 20:53:08 +00:00
Dmitry Dygalo
1c5c6eeb7a Fixed test execution. 2016-02-03 21:19:20 +01:00
Kenneth Reitz
7461371361 behold the power of requests 2016-02-03 06:11:36 -05:00
Kenneth Reitz
20290e3f2c docs fix 2016-02-03 06:01:50 -05:00
Kenneth Reitz
87f04e2a32 docs cleanup 2016-02-03 05:59:49 -05:00
Kenneth Reitz
54d3b59f89 update 2016-02-03 05:50:45 -05:00
Kenneth Reitz
ba2b355168 Update README.rst 2016-02-03 05:33:23 -05:00
Kenneth Reitz
fbe104876e Update README.rst 2016-02-03 05:14:01 -05:00
Kenneth Reitz
4d97b5b39a Update README.rst 2016-02-03 05:13:34 -05:00
Kenneth Reitz
9057f7539b Update README.rst 2016-02-03 05:09:45 -05:00
Kenneth Reitz
9c939ec026 Update README.rst 2016-02-03 05:09:25 -05:00
Kenneth Reitz
72d8293e08 Update README.rst 2016-02-03 05:07:47 -05:00
Kenneth Reitz
33d2ba961b Update README.rst 2016-02-03 05:07:33 -05:00
Kenneth Reitz
ab22b3ea5f Update README.rst 2016-02-03 05:07:08 -05:00
Kenneth Reitz
c003797319 Update README.rst 2016-02-03 05:05:48 -05:00
Kenneth Reitz
52054be612 Update README.rst 2016-02-03 05:04:23 -05:00
Kenneth Reitz
f997c0590f Update README.rst 2016-02-03 05:02:06 -05:00
Kenneth Reitz
8c963b52ea standard 2016-02-03 04:59:42 -05:00
Kenneth Reitz
4095b26f13 readme cleanup 2016-02-03 04:58:22 -05:00
Kenneth Reitz
2d0d291f5a Merge branch 'master' of github.com:kennethreitz/requests 2016-02-03 04:54:07 -05:00
Kenneth Reitz
20b4bb7c36 revised readme 2016-02-03 04:52:50 -05:00
Kenneth Reitz
b1e97650f7 Update README.rst 2016-02-03 04:00:14 -05:00
Kenneth Reitz
6e35ec4c12 cleandup test_requests.py 2016-02-03 03:50:14 -05:00
Kenneth Reitz
90688c68ad cleanup setup.py from #2991 2016-02-03 03:37:52 -05:00
Kenneth Reitz
458cb64e3d cleanup tests from merge of #2991 2016-02-03 03:35:51 -05:00
Kenneth Reitz
5481db22b5 Merge pull request #2991 from Stranger6667/tests-refactoring
[WIP] Test suite refactoring
2016-02-03 03:26:27 -05:00
Dmitry Dygalo
6c2942b198 Initial work 2016-02-02 13:24:05 +01:00
Kenneth Reitz
b782e66462 happy belated new year 2016-02-02 02:33:53 -05:00
Cory Benfield
ed8cfd33e6 Merge pull request #2986 from untitaker/syntax-error
Fix syntax error
2016-01-30 19:14:20 +00:00
Markus Unterwaditzer
2140c98fa4 Fix syntax error 2016-01-30 19:59:58 +01:00
Cory Benfield
3f725bc226 Merge pull request #2985 from homeworkprod/patch-1
Fixed markup for/rendering of list in section "Custom Headers".
2016-01-30 14:00:14 +00:00
Jochen Kupperschmidt
0d25f8a00c Fixed markup for/rendering of list in section "Custom Headers". 2016-01-30 14:45:07 +01:00
Kenneth Reitz
6195edc075 cleanup of auth __eq__ 2016-01-29 22:18:07 -05:00
Kenneth Reitz
f7447d1871 Merge pull request #2958 from Malizor/master
Add equality functions for authentication handlers
2016-01-29 22:08:26 -05:00
Kenneth Reitz
3f8b1fb617 Merge pull request #2984 from rbcarson/httpadapter-maxretries-doc
Remove int type on HTTPAdapter's max_retries argument doc
2016-01-29 21:59:03 -05:00
Carson Lam
a02069ec9e Remove int type on max_retries argument. 2016-01-29 15:30:22 -08:00
Ian Cordasco
645ac3087f Merge pull request #2981 from Lukasa/unencrypted-keys
Warn about encrypted keys in the docs.
2016-01-27 10:19:26 -06:00
Cory Benfield
5887b136e3 Warn about encrypted keys in the docs. 2016-01-27 11:56:27 +00:00
Cory Benfield
00fa5f171c Merge pull request #2976 from shoma/fix-debug-logging-doc
Fix api doc of debug logging for Python 3
2016-01-22 07:12:01 +00:00
shoma
75c7e5f1c3 Update example for Python 2/3 compatible. 2016-01-22 13:48:22 +09:00
shoma
ceb88ac077 Fix api doc of debug logging for Python 3 2016-01-22 12:47:18 +09:00
Cory Benfield
d76f304462 Merge pull request #2972 from munro/master
Return request & response with TooManyRedirects
2016-01-21 23:01:58 +00:00
Ryan Munro
56a1b55a42 Use httpbin to assert the final redirection URL 2016-01-20 11:24:03 -08:00
Ryan Munro
1f05867493 Add exception message to TooManyRedirects test 2016-01-20 11:06:39 -08:00
Ryan Munro
6a8a480d6c Review changes to TooManyRedirect exception with response 2016-01-20 10:48:12 -08:00
Cory Benfield
8b92d9989b Merge pull request #2973 from sigmavirus24/no-distutils-fallback
Stop falling back to distutils in setup.py
2016-01-20 13:54:58 +00:00
Ian Cordasco
5f2fef5bb5 Stop falling back to distutils in setup.py
distutils has been deprecated for years now and pip is refusing to install
projects using it. As such, *some* users are reporting problems installing
requests. Let's avoid this entirely by not falling back to distutils at all.
2016-01-20 07:51:42 -06:00
Ryan Munro
5a18066c45 Fix Python 3.x tests for TooManyRedirects API 2016-01-19 16:59:18 -08:00
Ryan Munro
e6f218f3f6 Return request & response with TooManyRedirects 2016-01-19 16:44:58 -08:00
Kenneth Reitz
6592dbc29b github_banner 2016-01-15 18:57:40 -05:00
Kenneth Reitz
851d65efb7 remove hellobar 2016-01-15 18:55:26 -05:00
Kenneth Reitz
7250665297 Python 3.5 2016-01-15 18:45:17 -05:00
Kenneth Reitz
f9d5cbe5b5 add github banner 2016-01-15 18:44:56 -05:00
Kenneth Reitz
07d8c28a75 align rezzy the sea turtle 2016-01-15 18:41:30 -05:00
Kenneth Reitz
820d31d5e2 Merge pull request #2915 from onceuponatimeforever/alabaster_sphinx_theme
Switch to alabaster sphinx theme in the docs
2016-01-15 18:35:03 -05:00
Kenneth Reitz
fe0850f341 Update conf.py 2016-01-15 17:57:46 -05:00
Nicolas Delvaux
06df08e676 Add equality functions for authentication handlers 2016-01-04 17:01:06 +01:00
Cory Benfield
a3acd30bcc Socks extra 2015-12-31 09:19:45 +00:00
Cory Benfield
e4d15c4649 Help @sigmavirus24 with code golf. 2015-12-30 16:45:51 +00:00
Cory Benfield
11b9b24ac9 Some code cleanups. 2015-12-30 14:37:53 +00:00
Cory Benfield
1c54014daf Don't parse nonexistent URLs. 2015-12-30 10:48:29 +00:00
Cory Benfield
39ee5d46dc Silence SOCKS dependency warning on import 2015-12-30 10:40:30 +00:00
Cory Benfield
08364c6739 Add support for SOCKS 2015-12-30 10:40:24 +00:00
Cory Benfield
396963ac7e Temporary urllib3 patch 2015-12-30 10:40:12 +00:00
Cory Benfield
cd84b3ff94 Update to urllib3 1.14 2015-12-30 10:07:16 +00:00
Cory Benfield
cbb0830ee9 Merge pull request #2948 from vincentbernat/patch-1
advanced: use "client.*" to designate client certificate
2015-12-28 15:58:54 +00:00
Vincent Bernat
f14f30817e advanced: use "client.*" to designate client certificate
Using "server.crt" is confusing as one may try to put the server certificate while this is really the client certificate that should be put here. Instead, use "client.cert", "client.key" and "client.pem".
2015-12-28 16:21:53 +01:00
Cory Benfield
a1c9b8439c Merge pull request #2945 from ibnIrshad/fixdocs-2062
Docs: clarify the precedence of `auth=` over `netrc`
2015-12-21 18:49:52 +00:00
Isa Hassen
fcb8c8d33b Docs: clarify the precedence of auth= over netrc
This closes #2062 by clarifying in the docs which auth
header takes precedence:
1st auth=
2nd .netrc
3rd headers=

This precedence order is already tested in test_requests.py,
in the test_basicauth_with_netrc method. Perhaps we should
add further tests for non-basic auth schemes.
2015-12-21 11:52:45 -05:00
Cory Benfield
1108058626 v2.9.1 2015-12-21 14:53:36 +00:00
Ian Cordasco
06a411c289 Merge pull request #2937 from Lukasa/release/2.9.1
Release 2.9.1
2015-12-21 08:51:21 -06:00
Ian Cordasco
728c318080 Merge pull request #2936 from Lukasa/netrc_with_bytes_url
Handle bytes and unicode URLs for netloc
2015-12-19 11:34:34 -06:00
Cory Benfield
6e0649d9f8 Push code review advice from @sigmavirus24 2015-12-19 08:44:21 +00:00
Cory Benfield
46b7f19857 Changelog for urllib3 update 2015-12-19 08:41:51 +00:00
Cory Benfield
834a9601c3 Update urllib3 to 1.13.1 2015-12-19 08:40:39 +00:00
Cory Benfield
b444f21b1f Update changelog for 2.9.1 2015-12-18 09:54:42 +00:00
Cory Benfield
589f13ca9d Handle bytes and unicode URLs for netloc 2015-12-18 09:22:23 +00:00
Cory Benfield
f7cb796241 Merge branch 'fix-1859' 2015-12-18 09:18:10 +00:00
Cory Benfield
96a068b58e Merge branch 'master' into fix-1859 2015-12-18 09:14:13 +00:00
Ian Cordasco
b32c3bc10f Merge pull request #2931 from Lukasa/uploading_bytes
Fix regression from #2844 regarding binary bodies.
2015-12-16 09:20:26 -06:00
Cory Benfield
fc8fa1aa26 Fix regression from #2844 regarding binary bodies. 2015-12-16 14:56:13 +00:00
Cory Benfield
5f7a3a74aa v2.9.0 2015-12-15 15:29:27 +00:00
Ian Cordasco
046a0f215d Merge pull request #2927 from Lukasa/release/2.9.0
Prepare 2.9.0 release.
2015-12-15 09:26:56 -06:00
Cory Benfield
424fe263d8 Suggested wording from @sigmavirus24 2015-12-15 15:20:26 +00:00
Cory Benfield
2f744b5010 Update 2.9.0 release log. 2015-12-15 14:59:14 +00:00
Cory Benfield
3c0f0b9ab5 Update urllib3 to 1.13 2015-12-15 14:47:20 +00:00
Ian Cordasco
3d33f30436 Merge pull request #2926 from bsamek/master
Refactor default params
2015-12-11 16:13:53 -06:00
Brian Samek
9aca57d4bf Revert changes to params
This reverts commit 9a20afd6b5.

Docstring changes were desirable, but changes to params were not.
2015-12-11 16:47:47 -05:00
Brian Samek
9a20afd6b5 Refactor default params
Specified the default argument for params that have a default in the docstring
so that the default is easier to see from the code. Modified the docstring in
api.py to match the docstring in sessions.py.
2015-12-11 13:32:09 -05:00
Cory Benfield
2d91365cba Merge pull request #2923 from bsamek/verifyparam
Add hint to :param verify.
2015-12-09 16:33:09 +00:00
Brian Samek
3ad66349ea Add hint to :param verify.
It is not clear that :param verify defaults to True. The way the verify
portion of the docstring is written it looks like it defaults to False, and
you have to pass in True if you'd like the SSL cert to be verified, but the
opposite is the case.
2015-12-09 11:21:21 -05:00
Braulio Valdivielso Martínez
534ee814fc Tested timeouts in text_response_server requests retrieval 2015-12-08 20:54:12 +01:00
Braulio Valdivielso Martínez
3eeea3771b Added a way for TestServer request handlers to store data for later retrieval by the main thread (actual requests, for example) 2015-12-08 20:40:58 +01:00
Braulio Valdivielso Martínez
578b032555 Tested TestServer multiple request handling 2015-12-08 16:37:03 +01:00
Braulio Valdivielso Martínez
4a41c591f8 Tested text_response_server 2015-12-08 16:23:02 +01:00
Braulio Valdivielso Martínez
3b2a489e13 Added text_response_server classmethod to TestServer and updated basic_response_server to use it 2015-12-08 16:12:40 +01:00
Ian Cordasco
e48fea7fb3 Merge pull request #2917 from matt-jordan/qop
requests/auth: Handle an empty 'qop' attribute in an Authenticate challenge
2015-12-05 22:48:52 -06:00
Matt Jordan
5c19d3e07b requests/auth: Handle an empty 'qop' attribute in a Authenticate challenge
Some malfunctioning HTTP servers may return a qop directive with no token, as
opposed to correctly omitting the qop directive completely. For example:

header: WWW-Authenticate: Digest realm="foobar_api_auth", qop="",
        nonce="a12059eaaad0b86ece8f62f04cbafed6", algorithm="MD5",
        stale="false"

Prior to this patch, requests would respond with a 'None' Authorization header.
While the server is certainly incorrect, this patch updates requests to be
more tolerant to this kind of shenaniganry. If we receive an empty string for
the value of the qop attribute, we instead treat that as if the qop attribute
was simply not provided.

Closes #2916
2015-12-05 16:14:52 -06:00
Susan Tan
4d5e534467 Remove kenneth's sphinx themes from docs directory 2015-12-04 04:06:17 -08:00
Susan Tan
6e903de068 Switch to alabaster instead of kr sphinx theme for requests docs
Add in the pre-existing ad tracker Javascript tags from kr sphinx theme.
2015-12-04 04:06:14 -08:00
Ian Cordasco
40ce36671c Merge pull request #2896 from BraulioVM/master
[WIP] Set 'Transfer-Encoding: chunked' if data is a file with length 0
2015-12-02 08:35:41 -06:00
Braulio Valdivielso Martínez
5ecf789a6f Avoid server from blocking if an exception is found in the main thread 2015-12-02 02:02:09 +01:00
Braulio Valdivielso Martínez
aac32ac56e Updated tests relying on the old testserver and added basic test for chunked uploads 2015-12-02 01:53:39 +01:00
Braulio Valdivielso Martínez
6551c290fd Allow main thread to block testserver before closing 2015-12-02 01:52:32 +01:00
Cory Benfield
dfa97addcc Merge pull request #2909 from jwilk/spelling
Fix typos
2015-12-01 11:28:06 +00:00
Jakub Wilk
23d9b077d8 Fix typos 2015-12-01 12:24:56 +01:00
Cory Benfield
6cfe6e775f Merge pull request #2902 from jparise/jparise-authors
Include a link to my GitHub profile.
2015-11-26 14:57:10 +00:00
Jon Parise
27f5a15364 Include a link to my GitHub profile. 2015-11-26 09:34:01 -05:00
Braulio Valdivielso Martínez
6adabacd81 Close socket properly in test_server_closes 2015-11-26 01:11:18 +01:00
Braulio Valdivielso Martínez
b4b4661f46 Implemented test to verify that the context manager exits after the server is closed 2015-11-26 01:05:16 +01:00
Braulio Valdivielso Martínez
f7917c305a Make server set stop_event right after closing its socket 2015-11-26 01:04:27 +01:00
Braulio Valdivielso Martínez
11ad502b80 Added basic_response_server classmethod and tested it 2015-11-26 00:29:53 +01:00
Braulio Valdivielso Martínez
2ad3f07982 Make exceptions in the testserver.Server thread not block the main thread 2015-11-25 14:41:03 +01:00
Braulio Valdivielso Martínez
ab0f063d85 Made TestServer.Server listen on an arbitrary open port by default 2015-11-25 14:15:51 +01:00
Braulio Valdivielso Martínez
47e96c4e57 Renamed dummyserver to testserver 2015-11-25 14:05:21 +01:00
Braulio Valdivielso Martínez
b806ce15ba Make strings in DummyServer test bytestrings 2015-11-25 13:53:54 +01:00
Braulio Valdivielso Martínez
9a2cc99b06 Put docstring inside Server class 2015-11-25 13:52:53 +01:00
Ian Cordasco
c1f51fd100 Merge pull request #2898 from lndbrg/patch-1
Update adapters.py
2015-11-24 20:44:51 -06:00
Olle Lundberg
68db4132e3 Update adapters.py
Remove duplicate word.
2015-11-25 02:02:41 +01:00
Braulio Valdivielso Martínez
99825de025 Implemented dummy socket server interface and added one test 2015-11-24 23:08:38 +01:00
Braulio Valdivielso Martínez
4c82dbab6f Fix 'Transfer-Encoding: chunked' change 2015-11-24 13:42:13 +01:00
Braulio Valdivielso Martínez
6f6b2fd1d5 Set 'Transfer-Encoding: chunked' if data file length equals 0 2015-11-23 20:52:06 +01:00
Ian Cordasco
6506dc8f66 Merge pull request #2895 from Lukasa/contributing
Add basic CONTRIBUTING.md file
2015-11-20 08:14:59 -06:00
Cory Benfield
085a8768a2 Where did you get Requests? 2015-11-20 13:59:59 +00:00
Cory Benfield
e5d6630888 Add basic CONTRIBUTING.md file 2015-11-20 11:29:35 +00:00
Cory Benfield
6c47a0c5e9 Merge pull request #2891 from lorenzph/pyopenssl-min-version
Specify minimum pyOpenSSL version
2015-11-19 19:11:34 +00:00
Philip Lorenz
6597b53834 Specify minimum pyOpenSSL version
urllib3 requires "set_tlsext_host_name" which was only added in
pyOpenSSL 0.13. As some distributions (e.g. Ubuntu 12.04) still ship an
older version enforce the correct minimum version during installation.
2015-11-19 20:05:03 +01:00
Cory Benfield
2128321b85 Merge pull request #2878 from kiddick/master
Remove redundant json import.
2015-11-12 13:56:55 +00:00
unknown
de2a5f4332 Remove redundant json import. 2015-11-12 16:54:47 +03:00
Cory Benfield
6d0017ee6a Merge pull request #2873 from sigmavirus24/bug/2872
Fix super_len for partially read files
2015-11-11 07:52:47 +00:00
Ian Cordasco
5397ef71b3 Fix super_len for partially read files
Closes #2872
2015-11-10 21:22:24 -06:00
Ian Cordasco
0a1aaca024 Add failing test for #2872 2015-11-10 21:15:29 -06:00
Cory Benfield
4e89ba7077 Merge pull request #2869 from vienno/unnest-cookie-loop
unnest deep loop
2015-11-10 13:21:01 +00:00
vienno
f835843f87 error in github bio link 2015-11-10 14:07:55 +01:00
vienno
cf9da5b52e add myself to authors 2015-11-10 14:05:24 +01:00
vienno
d849d6e907 Replace 'if x' with 'if x is not None' in cookie loop 2015-11-10 13:58:09 +01:00
vienno
89178ebcdc Complete unnesting of if statements in cookie loop 2015-11-10 13:47:40 +01:00
vienno
a25a641fb4 unnest deep loop 2015-11-10 12:36:36 +01:00
Ian Cordasco
35170e180e Merge pull request #2858 from Lukasa/support_ca_cert_directories
Add support for a directory of CAs
2015-11-07 15:39:41 -06:00
Ian Cordasco
7d5d067e9c Merge pull request #2861 from Lukasa/broken_chunked_encoding
Fix breakage introduced by 8f591682
2015-11-07 11:50:50 -06:00
Cory Benfield
c1c164ba80 Removed test of chunked encoding 2015-11-07 14:08:15 +00:00
Cory Benfield
02576ae7e7 Merge pull request #2864 from aartur/master
Assure session is closed on exception.
2015-11-06 21:02:30 +00:00
Artur Siekielski
1ced0040bd Assure session is closed on exception. 2015-11-06 21:54:43 +01:00
Cory Benfield
e67cd15bc8 Fix breakage introduced by 8f591682 2015-11-05 18:54:40 +00:00
Ian Cordasco
f7e0494130 Merge pull request #2859 from kennethreitz/pytest-httpbin
Move test suite offline using pytest-httpbin
2015-11-05 09:37:22 -06:00
Cory Benfield
43b90d7f72 Remove remaining test that contacts external server. 2015-11-05 13:49:35 +00:00
Cory Benfield
7c91e27d01 Remove threaded test 2015-11-05 13:49:35 +00:00
Cory Benfield
15cf19431a Pin httpbin version. 2015-11-05 13:49:35 +00:00
Cory Benfield
be564e500c Fixup assertion broken in rewrite to py.test
Broke it in 0364a8ca7fc67b89f3e54d50fa3936d65e979b96
2015-11-05 13:49:35 +00:00
Cory Benfield
70d7b134c8 Stop being so specific when testing error strings. 2015-11-05 13:49:35 +00:00
Cory Benfield
a8fdba15b1 Use py.test style assertions 2015-11-05 13:49:35 +00:00
Cory Benfield
3bc189b0af Inject and use httpbin fixture everywhere. 2015-11-05 13:49:35 +00:00
Cory Benfield
9b63f9cd37 Make sure we unapply this patch. 2015-11-05 13:48:42 +00:00
Cory Benfield
f52287d999 Stop using HTTP and HTTPS schemes in one test. 2015-11-05 13:48:42 +00:00
Cory Benfield
a56db9ecc4 Stop inheriting from unittest.TestCase 2015-11-05 13:48:42 +00:00
Cory Benfield
e5053cd322 Define some httpbin fixtures. 2015-11-05 13:48:42 +00:00
Cory Benfield
de53523bef Add pytest-httpbin requirement. 2015-11-05 13:48:42 +00:00
Cory Benfield
0352ec0bd3 Add support for a directory of CAs 2015-11-05 13:21:21 +00:00
Cory Benfield
4dffe5efaa Update trove classifiers. 2015-11-05 10:38:25 +00:00
Ian Cordasco
8f460faa31 Merge pull request #2849 from annp89/master
Add 511 Network Authentication Required status code
2015-10-26 10:58:01 -05:00
Ann Paul
7dd94941c8 Add 511 Network Authentication Required status code to dict of status codes 2015-10-26 08:42:37 -07:00
Ian Cordasco
d290a9b4c6 Merge pull request #2825 from Lukasa/universal_newlines
Add warnings about text/binary mode files.
2015-10-24 09:37:16 -05:00
Cory Benfield
f1fd11e54f Emit warnings when using text mode files. 2015-10-24 09:29:23 +01:00
Cory Benfield
1dff6c9153 Merge pull request #2845 from gagoman/fix-2844
Fix issue #2844
2015-10-23 13:24:36 +01:00
Alex Khomchenko
edc68a0ac8 fix issue #2844 2015-10-23 15:22:36 +03:00
Cory Benfield
13ea7394cc Merge pull request #2831 from shagunsodhani/proposed-fix-for-#2826
added fix for #2826
2015-10-16 13:21:45 +01:00
shagun Sodhani
b675377dc2 added fix for #2826 2015-10-16 17:01:36 +05:30
Cory Benfield
58b20d671c Merge pull request #2829 from dblia/getresponse-buffering
Use buffering for HTTP responses on chunked requests
2015-10-15 15:37:06 +01:00
Dimitris Bliablias
8f591682e6 Use buffering for HTTP responses on chunked requests
For non-chunked requests, the request is performed using the 'urlopen'
method that underlying uses buffering for the HTTP responses (for Python
2.7+ versions). For chunked requests though, the request is made via a
different code path and so the 'getresponse' method is called without
using buffering. So, the response is consumed per single byte via a
recv() call on the underlying socket.

This patch, fixes that issue to mimic the non-chucked request behavior.
2015-10-15 16:58:07 +03:00
Cory Benfield
6c2d09dc2f Merge pull request #2827 from daniel-mueller/master
Fixed usage example in sessions.py
2015-10-15 14:01:13 +01:00
Daniel Müller
d8f28f4bca Fixed usage example in sessions.py 2015-10-15 14:32:35 +02:00
Cory Benfield
7c55446b7e Add warnings about text/binary mode files. 2015-10-14 13:23:19 +01:00
Cory Benfield
18a6b60110 v2.8.1 2015-10-13 13:55:09 +01:00
Cory Benfield
14a555ac71 Merge pull request #2821 from Lukasa/issue/2818
Allow non-native-string method names.
2015-10-12 15:50:53 +01:00
Cory Benfield
2df3c7c75d Move to_native_string for methods to prepare() 2015-10-12 10:50:37 +01:00
Cory Benfield
b071c49556 Failing test for issue #2818 2015-10-12 10:48:57 +01:00
Ian Cordasco
978a89d5a3 Merge pull request #2810 from Lukasa/certupdate
Update requests certificate bundle.
2015-10-08 11:12:09 -05:00
Ian Cordasco
931fd0eece Merge pull request #2814 from Lukasa/issue/2813
Use general null check for JSON
2015-10-08 10:13:08 -05:00
Cory Benfield
3948a9562d Use general null check for JSON 2015-10-08 14:53:35 +01:00
Ian Cordasco
2da8a604d3 Merge pull request #2812 from Lukasa/issue/2811
Don't treat NewConnectionErrors as timeouts.
2015-10-08 08:10:01 -05:00
Cory Benfield
f7be4e5f28 NewConnectionErrors aren't timeouts.
This is a compatibility change, and should be removed in 2.8.0
2015-10-08 14:05:17 +01:00
Cory Benfield
23051979f4 Update requests certificate bundle.
This brings it up-to-date with the certifi 2015.9.6.2 release,
specifically its `weak.pem` bundle.
2015-10-08 08:09:53 +01:00
Ian Cordasco
e499b354c4 Merge pull request #2804 from Lukasa/final-2.8.0
Final 2.8.0
2015-10-05 11:21:40 -05:00
Cory Benfield
ba7d09354a Changelog for #2785. 2015-10-05 15:57:05 +01:00
Ian Cordasco
96e9490100 Merge pull request #2803 from asieira/master
Update default user-agent (#2785)
2015-10-05 09:54:17 -05:00
Cory Benfield
397f10bac7 Increment version numbers. 2015-10-05 15:41:04 +01:00
Cory Benfield
8dcd9f12de Prepare changelog for 2.8.0 2015-10-05 15:38:31 +01:00
Cory Benfield
09bd3232dd Update urllib3 to 1.12 2015-10-05 15:38:24 +01:00
Alexandre Sieira
4e44c2ab64 Removing change to .gitignore (#2785) 2015-10-05 11:36:21 -03:00
Cory Benfield
d996a95cf7 Merge pull request #2721 from Lukasa/no_proxy_fix
Ignore empty fields in no_proxy env var
2015-10-05 15:28:49 +01:00
Cory Benfield
f6afa71281 Merge pull request #2763 from ravipra/json_supersedes
Fixed issue #2756
2015-10-05 15:27:53 +01:00
Alexandre Sieira
2a635ba87d Update default user-agent (#2785)
* Updated default user agent so that it includes only the requests
version;
* Added PyCharm / IDEA project directory to `.gitignore`.
2015-10-05 11:18:23 -03:00
Cory Benfield
8963e1567b Merge pull request #2678 from sigmavirus24/proposed/2.8.0
Proposed 2.8.0
2015-10-05 15:09:41 +01:00
Cory Benfield
f7a43e2664 Merge branch 'hosamaly-master' 2015-10-03 18:33:38 +01:00
Cory Benfield
139418475c Remove reference to ok. 2015-10-03 18:33:25 +01:00
Cory Benfield
a89d5c003a Revert "Clarify the contract of Response#ok, and avoid exceptions in it"
This reverts commit 086e19d8e1.
2015-10-03 18:32:28 +01:00
Hosam Aly
086e19d8e1 Clarify the contract of Response#ok, and avoid exceptions in it 2015-10-03 16:34:36 +01:00
Hosam Aly
443d07e0d3 Fix #2799: Update Quickstart documentation of Response.json() 2015-10-03 00:01:58 +01:00
Cory Benfield
3c6f89b8f4 Merge pull request #2798 from Doctor-love/patch-1
Clarified description for option "trust_env"
2015-10-02 13:48:56 +01:00
Doctor-love
63b3b9be55 Clarified description for option "trust_env" 2015-10-02 14:47:50 +02:00
Cory Benfield
610fbd062f Merge pull request #2797 from sumitbinnani/DocumentationCorrection
Updated Documentation for Issue #2756
2015-10-02 10:08:23 +01:00
sumitbinnani
bf38d5bf52 Update models.py
Updated Documentation:
```data``` as well as ```files``` supersedes json
2015-10-02 13:50:52 +05:30
Cory Benfield
aead8c347c Merge pull request #2792 from Lukasa/update-test-dependencies
Update test dependencies
2015-10-01 10:27:25 +01:00
Cory Benfield
79675a0638 Update test dependencies 2015-10-01 10:26:14 +01:00
Cory Benfield
21bf8cd9bf Merge pull request #2789 from sigmavirus24/remove-self
Remove offer to pair with others from README
2015-09-30 14:29:27 +01:00
Ian Cordasco
76a0d3fcb9 Remove offer to pair with others from README 2015-09-27 21:48:42 -05:00
Kenneth Reitz
b8df8911c3 60m times 2015-09-24 13:40:49 -04:00
Cory Benfield
46ff1a9a54 Merge pull request #2775 from ueg1990/remove_unused_module
Removed unused module from hooks.py
2015-09-13 13:26:05 +01:00
ueg1990
649aeaa489 Removed unused module from hooks.py 2015-09-13 06:36:39 -04:00
Kenneth Reitz
9d69c7845d Merge pull request #2774 from ueg1990/pythonic_hooks
Some pythonic suggestions for requests/hooks.py
2015-09-13 01:05:34 -04:00
ueg1990
c5a41269d9 Some pythonic suggestions for requests/hooks.py 2015-09-12 20:43:25 -04:00
Cory Benfield
7c74050d66 Merge pull request #2772 from jimbrowne/master
Move CA Certificates documentation next to SSL Cert Verification
2015-09-11 20:22:13 +01:00
Jim Browne
2cee3bb57a docs: move CA Certificates next to SSL Cert Verification 2015-09-11 10:50:23 -07:00
Cory Benfield
17a9e6da9e Merge pull request #2769 from jwilk/spelling
docs: Fix typos
2015-09-10 22:14:11 +01:00
Jakub Wilk
e9c94e0f06 docs: Fix typos 2015-09-10 22:45:59 +02:00
Ian Cordasco
ebc38f7825 Merge pull request #2767 from ueg1990/master
Remove redundant function call list when iterating over status codes
2015-09-10 12:38:25 -05:00
Usman Ehtesham Gul
96e8e8b92f Remove redundant function call list when iterating over status codes 2015-09-10 12:59:39 -04:00
Ravi Prakash Putchala
1f48a4c9ea Removed the other 'encode' as well, in the test case. 2015-09-09 14:43:22 +05:30
Ravi Prakash Putchala
7a0cd16c1a changed the null check for 'data' parameter to be more explicit.
removed the superfluous encode from the testcase.
2015-09-09 13:04:24 +05:30
Ravi Prakash Putchala
37037607b5 Fixed issue #2756
Now 'json' parameter will be used to prepare body only if the 'data'
parameter is not present
2015-09-08 14:45:46 +05:30
Cory Benfield
56ecdebcc5 Merge pull request #2741 from jasongrout/per-host-proxy
Implement per-host proxies
2015-09-06 15:02:40 +12:00
Cory Benfield
14ee84b5fd Merge pull request #2758 from mhils/patch-1
Fix RFC Quotation
2015-09-06 09:01:39 +12:00
Maximilian Hils
f4eaefa63e fix rfc quotation 2015-09-05 12:07:49 +02:00
Jason Grout
704a922fc2 Clarify documentation for per-host proxies
Make sure it's clear that a per-host proxy matches a scheme and exact
hostname.
2015-09-04 22:55:38 +00:00
Ian Cordasco
719c76cd9d Merge pull request #2753 from Lukasa/ssldocs
Document the string form of the verify parameter.
2015-08-31 20:34:11 -05:00
Cory Benfield
7c958ee28e Document the string form of the verify parameter. 2015-08-31 10:26:06 +01:00
Ian Cordasco
bf9e66364f Merge pull request #2751 from carlosvargas/master
Add link to ES translation.
2015-08-29 07:21:07 -05:00
Carlos Vargas
00d8c24fe1 Add link to ES translation. 2015-08-28 19:12:10 -07:00
Jason Grout
4c6540898c don't lowercase a url before urlparsing it
urlparse automatically lowercases the scheme and hostname
2015-08-28 20:20:07 +00:00
Jason Grout
f3d4480a33 Use url parsing to check the scheme 2015-08-28 20:06:45 +00:00
Jason Grout
fb496e4e86 Add test for per-host proxy selection 2015-08-27 18:21:04 +00:00
Jason Grout
c80121df91 Fix documentation for the proxies dictionary 2015-08-27 18:21:04 +00:00
Jason Grout
500f15da1f Factor out the proxy selection code 2015-08-27 18:21:04 +00:00
Jason Grout
2c8721540a Fix documentation for proxies in the Session class 2015-08-27 17:26:45 +00:00
Jason Grout
d7a3aa6188 Fix another place the proxy-selecting logic is used. 2015-08-27 17:26:14 +00:00
Ian Cordasco
bf436ea0a4 Merge pull request #2746 from csparpa/master
Add link to IT translation
2015-08-25 19:38:04 -05:00
csparpa
a2e828d4d7 Add link to IT translation 2015-08-25 22:09:10 +02:00
Jason Grout
22075f02d0 Clarify the per-host proxy code 2015-08-25 18:21:20 +00:00
Jason Grout
618514231b Reword documentation for per-host proxies 2015-08-25 15:11:27 +00:00
Jason Grout
56844d1287 Add documentation for host-specific proxies 2015-08-25 14:53:52 +00:00
Cory Benfield
e57925223f Merge pull request #2743 from sigmavirus24/fix-py26-tests
Fix tests on python 2.6
2015-08-25 08:27:20 +01:00
Ian Cordasco
66567e037b Fix tests on python 2.6 2015-08-24 20:47:22 -05:00
Ian Cordasco
767cc9d2dc Merge pull request #2742 from everett-toews/data-arg
Include file-like object in data arg description
2015-08-24 20:44:45 -05:00
Everett Toews
8b03cd96cb Include file-like object in data arg description 2015-08-24 18:28:41 -05:00
Jason Grout
48fe34447d Implement per-host proxies
This change allows the proxy dict to be have entries of the form
{'<scheme>://<hostname>': '<proxy>'}.  Host-specific proxies will be used in
preference to the scheme-specific proxies (i.e., proxy dict entries with keys
like 'http' or 'https').

Fixes #2722
2015-08-24 21:16:35 +00:00
Cory Benfield
cef2589436 Merge pull request #2740 from qingyunha/master
params of proxy_headers are inconsistent with its docstrings
2015-08-24 13:43:01 +01:00
qingyunha
9d88810d52 modify proxy_headers docstrings 2015-08-24 19:48:17 +08:00
Cory Benfield
5d6d1bc284 Merge pull request #2737 from mjpieters/fix_dict_iteration_issue_2706
Avoid altering dictionary size during iteration
2015-08-21 09:08:19 +01:00
Martijn Pieters
4947cd01ae Avoid altering dictionary size during iteration, by gathering keys that need to be deleted first.
Fixes `RuntimeError` on Python 3 introduced in 53ea23128e
2015-08-21 08:44:09 +01:00
Ian Cordasco
c7c26fb8eb Merge pull request #2730 from bmispelon/doc-codeblock-fix
Fixed minor rendering issue in documentation code blocks
2015-08-15 15:02:06 -05:00
Baptiste Mispelon
7197afa887 Fixed minor rendering issue in documentation code blocks 2015-08-15 21:56:24 +02:00
Cory Benfield
3cf4ec41b9 Merge pull request #2729 from smiley/patch-1
Add own name to "AUTHORS" after PR #2724
2015-08-15 14:42:21 -04:00
Smiley Barry
2411b1f56a Added name to AUTHORS after PR #2724 2015-08-15 21:00:13 +03:00
Ian Cordasco
53ea23128e Merge pull request #2706 from ak1r4/fix-merge-setting
Fix merge setting for not preserving original order of dict parameters
2015-08-15 10:39:46 -05:00
Cory Benfield
fdc76f12e5 Merge pull request #2728 from lukasgraf/docs-fix-timeout-links
Docs: Fix links to `timeouts` section by using :ref:
2015-08-15 09:24:20 -04:00
Lukas Graf
f40bd0f707 Docs: Fix links to timeouts section by using :ref: instead of
linking to .html files.
2015-08-15 12:03:05 +02:00
Cory Benfield
98a59e4894 Merge pull request #2724 from smiley/master
Add documentation in "More complicated POST requests" (Quickstart) to resolve #2686
2015-08-14 15:30:00 -04:00
Smiley Barry
b1de7e7287 Changed phrasing to be a little clearer. 2015-08-14 17:31:54 +03:00
Smiley Barry
5a9097dc4b Update quickstart.rst
Added note about the `json` parameter in `requests.post`.
2015-08-14 17:15:51 +03:00
Cory Benfield
b6127ca9ca Ignore empty fields in no_proxy 2015-08-13 15:04:49 -04:00
Ian Cordasco
408d75d47a Merge pull request #2713 from lukasgraf/master
Docs: Clarify that method-level parameters are not persisted in sessions.
2015-08-07 20:18:21 -05:00
Lukas Graf
1bb91653cc Docs: Clarify that method-level params are not persisted in sessions. 2015-08-08 01:57:06 +02:00
Kenneth Reitz
313143959e Merge pull request #2712 from lukasgraf/master
Document use of sessions as context managers
2015-08-07 16:41:21 -04:00
Lukas Graf
8f3ddbeefb Mention connection pooling in session docs. 2015-08-07 20:48:07 +02:00
Lukas Graf
75c1776bde Document use of sessions as context managers. 2015-08-07 20:48:03 +02:00
Cory Benfield
5d7392f140 Merge branch 'fix-merge-setting' of https://github.com/ak1r4/requests into proposed/2.8.0 2015-08-06 19:06:23 -04:00
Akira J
276202f51e Fix merge setting for not preserving original order of dict parameters 2015-08-04 22:47:12 +01:00
Cory Benfield
9b067db19e Merge pull request #2704 from sYnfo/patch-1
Mention SNI being backported to Python2.7.9 in FAQ
2015-08-04 09:54:30 -04:00
Matej Stuchlik
e8a4784c8f Mention SNI being backported to Python2.7.9 in FAQ
That happened as part of PEP 466 - "Network Security Enhancements for Python 2.7"
2015-08-04 15:05:35 +02:00
Cory Benfield
9648301e1e Merge pull request #2680 from peplin/patch-1
Fix docs for passing a list of values for a query string
2015-07-19 10:57:01 +01:00
Christopher Peplin
6648defcdd Fix docs for passing a list of values for a query string
The special `[]` notation at the end of the field name is not necessary to get a field to appear with multiple values in the query string.
2015-07-18 18:50:29 -04:00
Ian Cordasco
873f834fc9 Merge remote-tracking branch 'upstream/master' into proposed/2.8.0 2015-07-18 10:57:34 -05:00
Ian Cordasco
31817b66c6 Fix pool connection closed test 2015-07-18 10:57:28 -05:00
Cory Benfield
b4c1feac43 Merge pull request #2679 from sigmavirus24/bug/2668
Remove broken CaseInsensitiveDict repr test
2015-07-18 16:48:26 +01:00
Ian Cordasco
b8a297baab Remove broken CaseInsensitiveDict repr test
Fixes #2668
2015-07-18 10:47:26 -05:00
Ian Cordasco
d0aecb271f Merge pull request #2506 from Lukasa/chunkeddocs
Expand on chunked handling.
2015-07-18 10:44:31 -05:00
Ian Cordasco
d7026bfb2a Upgrade urllib3 to 7fcfcd08a6a2150f93144d111904d1e4fb65c909 2015-07-18 10:43:26 -05:00
Cory Benfield
2b5cdc56f3 Expand on chunk length 2015-07-18 16:41:29 +01:00
Ian Cordasco
77d7e53c12 Merge branch 'auth-digest-multi-thread' of https://github.com/exvito/requests into proposed/2.8.0 2015-07-18 10:38:58 -05:00
Ian Cordasco
1e640c8456 Merge branch 'debian-imports' of https://github.com/untitaker/requests into proposed/2.8.0 2015-07-18 10:38:30 -05:00
Susan Tan
5ec7576f23 Catch and wrap ClosedPoolError
Partially resolves #1572: "urllib3 exceptions passing through requests
API".

Inspired from Lukasa's 2605be11d82d42438ac7c3993810c955bde74cef.
2015-07-17 01:30:51 -07:00
Ian Cordasco
0be38a0c37 Merge pull request #2672 from petedmarsh/fix-custom-headers-example
Fix quickstart "Custom Headers" example intro
2015-07-15 20:51:06 -05:00
Peter Marsh
beaa7e4180 Fix quickstart "Custom Headers" example intro
Previously this section prefaced an example with:

    For example, we didn't specify our content-type

But, the actual example set a custom user-agent header on the request. This
changes it to say "user-agent" instead which matches the given example.
2015-07-15 23:31:21 +01:00
Cory Benfield
2b26489f74 Merge pull request #2666 from gvangool/extra_tests
Adds extra tests for CaseInsensitiveDict
2015-07-14 07:57:58 +01:00
Gert Van Gool
3b325f1bc5 assert that the copy() is not the original 2015-07-14 08:10:13 +02:00
Gert Van Gool
47e71d1774 Don't test the NotImplemented, just make sure it's False 2015-07-13 15:07:38 +02:00
Gert Van Gool
147a305da8 Adds extra tests for CaseInsensitiveDict
- Test for NotImplemented in __eq__
- Adds test for copy()
- Adds test for __repr__()
2015-07-13 14:33:50 +02:00
Ian Cordasco
2440b6f089 Merge pull request #2661 from Lukasa/timeouts_are_tricky
Only pass useful timeouts to _get_conn
2015-07-04 15:19:37 -05:00
Cory Benfield
e9a1e35f89 Only pass useful timeouts to _get_conn 2015-07-03 17:00:38 +01:00
Cory Benfield
e4d59bedfd Merge pull request #2656 from dpursehouse/get_netrc_auth_errors
Allow get_netrc_auth to raise parse/permission errors to caller
2015-06-29 08:24:21 +01:00
David Pursehouse
884cb7a7fb Change ignore_errors to raise_errors in get_netrc_auth
Change-Id: Ib82c7c614edafc15e5db858d9c1b9a73aebd8a95
2015-06-29 12:22:57 +09:00
David Pursehouse
a560e09427 Allow get_netrc_auth to raise parse/permission errors to caller
If the netrc file exists but cannot be parsed or read, get_netrc_auth
silently fails.

Add a new argument `ignore_errors` which when set to False will cause
any parse/permission errors to be raised to the caller.  The default
value is True, which means the default behavior is unchanged.

Fixes #2654

Change-Id: I7436aaaf593178673ab84fd9e7ab4bcb0e3fe75e
2015-06-29 10:56:51 +09:00
Ian Cordasco
f5dacf8446 Merge pull request #2648 from msabramo/display_url_for_exceptions
Display URL as part of HTTP error messages
2015-06-22 16:16:28 -05:00
Marc Abramowitz
e3bdec5934 Display URL as part of HTTP error messages
It seems convenient to include the URL in the error message in case you
get an unexpected error.

E.g.:

    In [1]: import requests

    In [2]: resp = requests.get('http://www.google.com/eofdfdfdfdfd')

    In [3]: resp
    Out[3]: <Response [404]>

    In [4]: resp.raise_for_status()
    ---------------------------------------------------------------------------
    HTTPError                                 Traceback (most recent call last)
    <ipython-input-4-00e7077cfb5b> in <module>()
    ----> 1 resp.raise_for_status()

    /Users/marca/dev/git-repos/requests/requests/models.py in raise_for_status(self)
        835
        836         if http_error_msg:
    --> 837             raise HTTPError(http_error_msg, response=self)
        838
        839     def close(self):

    HTTPError: 404 Client Error: Not Found for url: http://www.google.com/eofdfdfdfdfd
2015-06-22 13:22:59 -07:00
Ian Cordasco
9bbab338fd Merge pull request #2640 from Lukasa/issue/2636
Avoid double releasing chunked upload connections
2015-06-13 08:54:40 -05:00
Cory Benfield
2e62df456a Avoid double releasing chunked upload connections
Resolves #2636
2015-06-13 08:10:53 +01:00
Cory Benfield
8b5e457b75 Merge branch 'colindickson-master' 2015-05-26 20:54:51 +01:00
colin
fd31453aa2 fix unittest typo 2015-05-26 20:53:31 +01:00
Ian Cordasco
a92a2a4263 Merge pull request #2615 from awiddersheim/docs/add_section_labels
Docs: Add more section labels for referencing
2015-05-26 09:12:33 -05:00
Andrew Widdersheim
7ba130a0cb Docs: Add more section labels for referencing
Allows for sections to be linked from other projects using Intersphinx.
2015-05-26 09:16:24 -04:00
Cory Benfield
dfdf371a0f Merge pull request #2610 from colindickson/master
fix contextlib.closing bug for sessions where content is not consumed…
2015-05-25 18:15:57 +01:00
colin
f608547bef Merge remote-tracking branch 'origin/master'
Conflicts:
	test_requests.py
2015-05-24 15:02:36 -04:00
colin
1da62a65d9 fix contextlib.closing bug for sessions where content is not consumed (issue #2593) 2015-05-24 15:01:34 -04:00
colin
8d0889b91b fix contextlib.closing bug for sessions where content is not consumed (issue #2593) 2015-05-24 09:59:35 -04:00
Cory Benfield
3c850b3339 Merge pull request #2608 from radarhere/patch-1
Fixed typos
2015-05-21 09:16:24 +01:00
Andrew Murray
d249c0a9c6 Fixed typo in contributing.rst 2015-05-21 10:31:42 +10:00
Andrew Murray
d866d8a44d Fixed typos in HISTORY.rst 2015-05-21 10:25:42 +10:00
Ian Cordasco
ab1f493c8b Merge branch 'max-age-pr' 2015-05-15 10:13:42 -05:00
latyas(懒)
dd0f164f8e Update cookies.py 2015-05-15 10:13:06 -05:00
Cory Benfield
059e105f8f Use complexjson everywhere 2015-05-15 10:13:06 -05:00
Cory Benfield
395a3e8885 Partially revert ab84f9be57 2015-05-15 10:13:06 -05:00
latyas(懒)
d3bd3630ee max-age may be not digits 2015-05-15 10:16:35 +08:00
Ian Cordasco
639f8347a3 Merge pull request #2598 from Lukasa/not-poor
Partially revert ab84f9be57
2015-05-14 17:32:19 -05:00
Cory Benfield
553907aa6b Use complexjson everywhere 2015-05-14 22:30:24 +01:00
Cory Benfield
fb6dade63d Partially revert ab84f9be57 2015-05-14 20:58:20 +01:00
latyas(懒)
cda95d3cde morsel['max-age'] may be a str.
Example:

here are Set-Cookie list:
```python
sclst = ['dwac_bcIBMiaagZmkYaaadeYtg11eVR=j9jHdmPjUhgDOhyH9f89X4lQgehEmflVyeA%3D|dw-only|||CNY|false|Asia%2FShanghai|true; Path=/',
 'sid=j9jHdmPjUhgDOhyH9f89X4lQgehEmflVyeA; Path=/',
 'geoLocation=CN; Path=/',
 'dwpersonalization_fae107a9dd0fc32ed99532ec1977f31f=bc8sEiaagZqRsaaadk8XoNTL8h20150506; Expires=Sun, 14-Jun-2015 10:37:07 GMT; Path=/',
 'dwanonymous_fae107a9dd0fc32ed99532ec1977f31f=abjpA8kng31LjPp8ZEERDT4XVg; Version=1; Comment="Demandware anonymous cookie for site Sites-abercrombie_cn-Site"; Max-Age=15552000; Expires=Tue, 10-Nov-2015 10:37:07 GMT; Path=/',
 'myStore=91156; Path=/',
 'AF_PREF=en_CN; Path=/',
 'dwsid=MiHJy3KYZKDcN0lZg4HS1zSpj1VV4s_tFu39ar0KXNpAx9aX8X2LlvZQ9m5fOOknb6QXtmmukHcOjmivYf31hg==; path=/; HttpOnly']
```

```python
    for sc in sclst:
        C = Cookie.SimpleCookie(sc)
        for morsel in C.values():
            cookie = requests.cookies.morsel_to_cookie(morsel)
            cookiejar.set_cookie(cookie)
```
Then, exception occured
```shell
  File "/Library/Python/2.7/site-packages/requests/cookies.py", line 402, in morsel_to_cookie
    expires = time.time() + morsel['max-age']
TypeError: unsupported operand type(s) for +: 'float' and 'str'
```

As Cookie.SimpleCookie is in STL, should `morsel_to_cookie` check the type of `max-age`? On the other hand, if **max-age** can not be converted to float, it's illegal obviously.
2015-05-14 18:44:33 +08:00
Cory Benfield
c3c4c96a95 Merge pull request #2601 from sahutd/issue2599
Auth handler calls close instead of raw.close_conn
2015-05-14 07:15:10 +01:00
Saimadhav Heblikar
86aff09103 Auth handler calls close instead of raw.close_conn 2015-05-14 11:42:07 +05:30
Cory Benfield
4505f71829 Merge pull request #2597 from t-8ch/defensive_programming
do not blindly catch all AttributeErrors
2015-05-13 07:16:44 +01:00
Thomas Weißschuh
c6c8d649af do not blindly catch all AttributeErrors
see shazow/urllib3#618
2015-05-12 23:21:03 +00:00
Kenneth Reitz
868625532d Merge remote-tracking branch 'origin/master' 2015-05-06 12:42:47 -07:00
Kenneth Reitz
74609c5c8f cleanup styles a bit 2015-05-06 12:42:43 -07:00
Kenneth Reitz
ab84f9be57 removed poor code 2015-05-06 12:36:26 -07:00
Kenneth Reitz
3475399a47 fix captilization 2015-05-06 12:35:14 -07:00
Ian Cordasco
a6937534ce Merge pull request #2588 from gutworth/patch-1
use reST link syntax
2015-05-03 21:18:37 -05:00
Benjamin Peterson
ba7975fd16 use reST link syntax 2015-05-03 20:34:09 -04:00
Cory Benfield
b7bd297340 v2.7.0 2015-05-03 15:47:20 +01:00
Cory Benfield
ee7389da98 Synchronize urllib3 to 1.10.4 2015-05-03 15:16:07 +01:00
Cory Benfield
6acca21bae Merge pull request #2582 from mhavard999/master
Make docstring of api.get more clear
2015-05-01 06:59:46 +01:00
Matt Havard
6e9ebc06d1 Make docstring of api.get more clear 2015-04-30 23:54:34 -04:00
Kenneth Reitz
ff71b25efc release and version history 2015-04-25 17:50:03 -04:00
Kenneth Reitz
c8004e3dd7 Merge remote-tracking branch 'origin/master' 2015-04-25 17:49:14 -04:00
Kenneth Reitz
e859204554 new community 2015-04-25 17:49:12 -04:00
Kenneth Reitz
5d722bd0f5 Merge pull request #2570 from sigmavirus24/release-process-docs
Add new release process to docs
2015-04-25 17:46:31 -04:00
Kenneth Reitz
1f85ce8670 be cordial 2015-04-25 17:44:25 -04:00
Kenneth Reitz
51938de6b7 improve contributing section 2015-04-25 17:42:48 -04:00
Kenneth Reitz
535c51f548 style of contributing.rst 2015-04-25 17:36:14 -04:00
Kenneth Reitz
09023f5894 Merge pull request #2572 from Lukasa/contribution
Add basic contributing guide
2015-04-25 17:34:45 -04:00
Cory Benfield
9dba203952 Add basic contributing guide 2015-04-25 21:39:00 +01:00
Ian Cordasco
f74fc486be Update version number examples. Strip whitespace
Also I've included a bit more verbiage around why a major release
would happen and some reassurances that they will be rare.
2015-04-25 09:29:40 -05:00
Ian Cordasco
773e730d80 Add new release process to docs
Closes #2569
2015-04-24 19:28:23 -05:00
Markus Unterwaditzer
93216afbaf Add information about the package stub 2015-04-24 15:29:19 +02:00
Markus Unterwaditzer
b7fc3a1250 Import aliases for Debian
Alternative to #2375
2015-04-24 12:05:19 +02:00
Ian Cordasco
ca66267d2c Add release notes for 2.6.2
Closes #2561
2015-04-23 11:29:10 -05:00
Ian Cordasco
73b9b6906d Update urllib3 to 7b82da0fa3a13514d11a863e379e7541d0ec46ef 2015-04-23 11:27:42 -05:00
Ian Cordasco
3880cf1255 Merge pull request #2556 from sigmavirus24/release/2.6.1
Prepare v2.6.1
2015-04-22 17:12:26 -05:00
Ian Cordasco
ae7c28eb8e Update notes for 2.6.1 2015-04-22 16:52:40 -05:00
Ian Cordasco
3e3fc7683c Remove VendorAlias meta_path hook 2015-04-22 16:26:14 -05:00
Cory Benfield
3d339ed7e6 Update urllib3 to 0b744993
(cherry picked from commit df63ee3e13672caa6b3256c6579fa85caefb2729)
2015-04-22 13:16:12 -05:00
Ian Cordasco
cfb9e66b04 Update history and version number for v2.6.1 2015-04-22 09:10:48 -05:00
Ian Cordasco
5fcd843eb2 Update urllib3 to 10b7a0fefa6596f47a9a6afc80f1f4d1ae950b66 2015-04-22 08:17:39 -05:00
Kenneth Reitz
1f0e5775f2 add betamax 2015-04-21 17:18:04 -04:00
Kenneth Reitz
4cfc5bcd96 add @sigmavirus42's blog post 2015-04-21 17:15:51 -04:00
Cory Benfield
b906c04a6f Merge pull request #2553 from sigmavirus24/bug/2552
Simplify PreparedRequest.prepare API
2015-04-21 06:59:55 +01:00
Ian Cordasco
35045e851a Simplify PreparedRequest.prepare API
Do not require that hooks be passed as an empty list to
PreparedRequest.prepare. In the event hooks is None in prepare or
prepare_hooks, use an empty list as a default.

Related to #2552
2015-04-20 20:13:58 -05:00
Kenneth Reitz
16eeee1436 and extensions 2015-04-17 08:52:47 -04:00
Kenneth Reitz
576e18a796 recommended packages and extensions 2015-04-17 08:51:02 -04:00
Kenneth Reitz
d0e64d32ba Merge pull request #2550 from Lukasa/recommended
Recommended packages.
2015-04-17 08:44:38 -04:00
Cory Benfield
a0d9e0bc57 Merge pull request #2504 from pvanderlinden/bug/2503-resolve-redirect-pass-all-arguments
fix resolve redirect to pass all original arguments
2015-04-16 06:57:56 +01:00
Kenneth Reitz
5a799dd0f5 Merge pull request #2546 from Lukasa/crystals
Keepers of the Three Crystals.
2015-04-14 14:03:08 -04:00
Cory Benfield
8cf5e67041 Recommended packages. 2015-04-13 11:39:23 -04:00
Ian Cordasco
a0632d8df0 Minor formatting change 2015-04-10 22:03:26 -05:00
Ian Cordasco
5478dd6271 Merge pull request #2547 from sh1buy/bug_2540
Fix MisssingSchema error message does not handle unicode input correctly #2540
2015-04-10 21:59:13 -05:00
sh1buy
599f834351 fix bug 2540 2015-04-11 03:29:21 +03:00
sh1buy
f02d0f9e79 Fix bug 2540 2015-04-11 01:41:02 +03:00
sh1buy
f89b5a5d90 fix bug 2540 2015-04-11 00:23:07 +03:00
Cory Benfield
0cd9f5855e Keepers of the Three Crystals. 2015-04-10 14:40:52 -04:00
Kenneth Reitz
ccc03b93ef Test 2015-04-10 13:22:14 -04:00
Kenneth Reitz
b0c008c593 Merge pull request #2536 from smiley/master
Document that "PreparedRequest.prepare_cookies" can only be called once
2015-04-06 18:29:17 -04:00
Cory Benfield
a57c87a459 Merge pull request #2535 from sigmavirus24/bug/2530
Fix build version number in metadata
2015-04-06 17:54:22 -04:00
Smiley Barry
e3c7b43fc9 #2532: Documented strange behaviour in "PreparedRequest.prepare_cookies", caused by cookielib. Also documented a workaround if absolutely necessary. 2015-04-06 21:00:51 +03:00
Ian Cordasco
956ec8321a Merge pull request #2427 from luozhaoyu/master
Bug fix: field uri in digest authentication should not be empty when enc...
2015-04-06 10:19:15 -05:00
Cory Benfield
0581f2c7d2 Merge pull request #2533 from sigmavirus24/bug/2465-2
Place VendorAlias first in meta_path
2015-04-06 07:19:15 -04:00
Cory Benfield
1ff9a05181 Merge pull request #2534 from sigmavirus24/bug/2527
Copy a PreparedRequest's CookieJar reliably
2015-04-06 07:15:55 -04:00
Ian Cordasco
36093e69c7 Copy a PreparedRequest's CookieJar reliably
When a PreparedRequests's cookie jar is not a RequestsCookieJar instance, it
will not have a "copy" method. By adding _copy_cookie_jar we can reliably copy
cookie jars so that we have an actual copy instead of the same instance on
different prepared requests.

This also updates the RequestsCookieJar.update logic to create copies of
cookies from the other jar.

Closes #2527
2015-04-05 21:49:52 -05:00
Ian Cordasco
dacf69a16d Fix build version number in metadata
Closes #2530
2015-04-05 21:49:10 -05:00
Ian Cordasco
1b5bfe681b Place VendorAlias first in meta_path
When other libraries or tools add items to the meta_path, we need to preempt
some of their import hooks to be sure modules can be properly found. This also
prevents problems importing built-in modules on Python 2 where it will first
attempt to import something like:

    requests.packages.chardet.sys

By placing our VendorAlias first, the above will fail and then it will fall
back to trying to import sys directly instead.

Closes #2465
2015-04-05 20:48:36 -05:00
Cory Benfield
18e678c1f8 Merge pull request #2531 from benjaminran/issue2062
Issue 2062: Updated custom header precedence info with .netrc example
2015-04-05 23:33:29 +01:00
benjaminran
1b1866934b updated custom header precedence info with .netrc example 2015-04-05 14:23:10 -07:00
exvito
5a69137ac8 Issue #2334 - HTTPDigestAuth - Renamed thread local attribute
Per @sigmavirus24 suggestion: private and more readable.
2015-04-04 14:25:08 +01:00
exvito
36dea43406 Issue #2334 - HTTPDigestAuth - Improved per-thread state init
Inspired in @tardyp approach.
2015-04-03 17:04:33 +01:00
Cory Benfield
d294de38c4 Merge pull request #2525 from benjaminran/issue2062
Issue 2062: Added custom header precedence info
2015-04-03 16:57:54 +01:00
Pierre Tardy
142e24de7b digestauth: threadsafe test
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
2015-04-03 16:32:39 +01:00
benjaminran
898465756a added custom header precedence info 2015-04-03 07:58:42 -07:00
exvito
e8d9bc55bc Issue #2334 - HTTPDigestAuth - All state now in thread local storage
Following feedback from tardyp and @vincentxb.
2015-04-03 14:21:29 +01:00
exvito
e65360dbaf Issue #2334 - HTTPDigestAuth - Replace getattr utilization
Following Lukasa + kennethreitz suggestion.
2015-04-02 21:29:51 +01:00
exvito
845e8f943f Issue #2334 - HTTPAuthDigest - Making it thread-safe
The existing code counts the number of 401 responses in the num_401_calls
authenticator attribute. This is in place so as to ensure the necessary auth
header is sent, while avoiding infinite 401 loops (issue #547).

This commit makes num_401_calls an instance of threading.local() (previously
an integer), using num_401_calls.value as the counter.

It ensures that concurrent authentication requests get each their own counter
and behave as expected (otherwise every other concurrent request would have
its authentication fail).
2015-04-02 14:24:54 +01:00
Kenneth Reitz
0ad075c430 Update index.rst 2015-03-31 12:44:50 -04:00
Ian Cordasco
460caf71a4 Merge pull request #2518 from deronnax/shorter_version_extraction
shorter and faster version extraction from __init__.py
2015-03-27 07:49:29 -05:00
Cory Benfield
452ba32edf Merge pull request #2497 from Lukasa/secprocess
Requests security release policy
2015-03-27 11:03:41 +00:00
Paul van der Linden
587eb193dd fix resolve redirect to pass all original arguments 2015-03-26 19:57:16 +00:00
deronnax
1145fe64a5 matching the version only at the begining of lines 2015-03-26 15:53:19 +01:00
deronnax
ce234d53a5 shorter and faster version extraction from __init__.py 2015-03-25 18:21:34 +01:00
Cory Benfield
e95e173b8c Merge pull request #2514 from kennethreitz/revert-2513-master
Revert "Minor Patch TypeError thrown"
2015-03-23 15:13:14 +00:00
Ian Cordasco
b2ce5be9d0 Revert "Minor Patch TypeError thrown" 2015-03-23 10:11:13 -05:00
Cory Benfield
a0f5776f35 Merge pull request #2513 from Montycarlo/master
Minor Patch TypeError thrown
2015-03-23 06:18:48 +00:00
Josh Brown
1b5317ea08 Minor Patch TypeError thrown 2015-03-23 16:01:48 +11:00
Ian Cordasco
8dda20f8e3 Merge pull request #2512 from Lukasa/elapsed
Expand on what 'elapsed' means.
2015-03-22 14:51:17 -05:00
Cory Benfield
54791d1970 Expand on what 'elapsed' means. 2015-03-21 16:27:21 +00:00
Cory Benfield
b7e3370762 'At least' 2015-03-18 21:40:03 +00:00
Cory Benfield
84cc36017a Expand on chunked handling. 2015-03-18 21:31:55 +00:00
Cory Benfield
bedd2be0a7 Clarify that we ship patches early. 2015-03-18 21:27:20 +00:00
Cory Benfield
b974cd3741 Describe our new vulnerabilities process. 2015-03-17 20:07:28 +00:00
Cory Benfield
86f9b1616a Merge pull request #2501 from yasoob/master
Added myself to authors.rst
2015-03-16 20:31:09 +00:00
M.Yasoob Ullah Khalid ☺
dfa0a2925f added myself to authors.rst 2015-03-17 01:29:33 +05:00
M.Yasoob Ullah Khalid ☺
81d2d5535a Merge pull request #1 from kennethreitz/master
Only for me
2015-03-17 01:25:05 +05:00
Cory Benfield
cd3f7eb388 Merge pull request #2493 from yasoob/master
made the quickstart more reader friendly
2015-03-15 18:39:54 +00:00
M.Yasoob Ullah Khalid ☺
3711e04f37 edited the useragent string 2015-03-15 22:42:43 +05:00
Cory Benfield
8c6d82a244 Merge pull request #2496 from Lukasa/cve
Update 2.6.0 changelog with CVE number CVE-2015-2296
2015-03-15 11:50:51 +00:00
Cory Benfield
3385c78999 Update 2.6.0 changelog with CVE number. 2015-03-15 11:49:32 +00:00
M.Yasoob Ullah Khalid ☺
6e2f1eb402 made the quickstart more reader friendly. Closes #2418 2015-03-15 01:02:09 +05:00
Ian Cordasco
fa338da717 Merge pull request #2492 from sigmavirus24/release/v2.6.0
Bump version and add release notes for 2.6.0
2015-03-14 11:43:32 -05:00
Ian Cordasco
80a3e87bf3 Bump version and add release notes for 2.6.0 2015-03-14 11:42:38 -05:00
Ian Cordasco
bbbd9de6fd Merge pull request #2472 from scholer/master
Avoid data duplication when creating a Request with str/bytes/bytearray input
2015-03-14 07:43:17 -05:00
Ian Cordasco
e776bb2656 Merge pull request #2489 from Lukasa/cookiebad
Don't label cookies for the target domain.
2015-03-14 07:05:48 -05:00
Cory Benfield
f7c85685a8 Add explanatory comment for cookie change 2015-03-14 11:29:05 +00:00
Cory Benfield
8a2fd7ce6d Merge pull request #2486 from sigmavirus24/bug/2462
Extract version from requests/__init__.py instead of importing requests
2015-03-14 11:20:33 +00:00
Cory Benfield
76f7ce8a24 Merge pull request #2487 from ulope/return_type
Add return type field to entry-point docstrings
2015-03-14 11:19:12 +00:00
Ulrich Petri
573d460aa7 Add return type field to entry-point docstrings
Fixes: #2483
2015-03-14 10:49:32 +01:00
Cory Benfield
3bd8afbff2 Don't ascribe cookies to the target domain. 2015-03-14 08:49:55 +00:00
Ian Cordasco
1acc4992d4 Parse version number out of requests/__init__.py
With the new import machinery in requests/packages/__init__.py people
using `python setup.py test` will not be able to run the tests the first
time on a new environment. The VendorAlias logic breaks the import
machinery and the tests fail. By removing the import of requests in
setup.py, we avoid the issue where sys.meta_path continues to have the
version of VendorAlias from the import in setup.py.

Closes #2462
2015-03-13 21:47:29 -05:00
Cory Benfield
bc746e158c Merge pull request #2485 from sigmavirus24/bug/shazow/urllib3/567
Import urllib3's Retry location from the right place
2015-03-12 06:50:33 +00:00
Ian Cordasco
c4bd6ea150 Import urllib3's Retry location from the right place
Importing from urllib3's top-level location causes the namespace to be
urllib3.util.retry.Retry instead of
requests.packages.urllib3.util.retry.Retry. Without this fix, an using
requests with an un-vendored version of urllib3 will break when urllib3's
retry handling kicks in.

Closes shazow/urllib3#567
2015-03-11 20:52:12 -05:00
Ian Cordasco
9adaae6785 Merge pull request #2482 from sigmavirus24/update-urllib3
Update urllib3 to 43b5b2b452e4344374de7d08ececcca495079b8d
2015-03-11 09:52:11 -05:00
Ian Cordasco
a0790f37b7 Update urllib3 to 43b5b2b452e4344374de7d08ececcca495079b8d 2015-03-10 19:34:34 -05:00
Cory Benfield
14b653ab3c Merge pull request #2478 from plaes/iter-lines
Document Response.iter_lines() deficiencies
2015-03-07 10:03:42 +00:00
Priit Laes
4497a26c37 Document Response.iter_lines() reentrancy issues 2015-03-07 12:00:41 +02:00
Priit Laes
62200cb07e Add testcase to demonstrate r.iter_lines() reentrancy issue 2015-03-07 12:00:37 +02:00
Ian Cordasco
c53aa08cce Merge pull request #2429 from kennethreitz/sigmavirus24/docs/support
Update support documentation to be more accurate
2015-03-04 16:20:33 -06:00
Cory Benfield
bcfcd9f980 Add Lukasa's GPG key fingerprint. 2015-03-04 20:16:25 +00:00
Rasmus Scholer (TimelineX)
ec700a9a13 Avoid duplicating files data when creating a Request with str/bytes/bytearray in the files argument. 30-40% performance improvement. 2015-03-04 10:21:38 -05:00
Ian Cordasco
e7ac8ea0c1 Add PGP Key fingerprints 2015-03-04 08:11:39 -06:00
Ian Cordasco
39e49e5fb9 Merge pull request #2466 from sigmavirus24/bug/2465
Only add VendorAliases for vendored dependencies
2015-03-04 07:49:12 -06:00
Ian Cordasco
61f4faae70 Merge pull request #2468 from scholer/master
Support for bytearray when creating Request with files argument, just like str and bytes.
2015-03-03 14:01:31 -06:00
Rasmus Scholer (TimelineX)
1887f32b17 test_can_send_bytes_bytearray_objects_with_files test now uses string input, not float. 2015-03-03 14:37:39 -05:00
Rasmus Scholer (TimelineX)
326f77d57c Created test case for using bytes and bytearray objects with files argument to Request. 2015-03-03 03:41:00 +01:00
Rasmus Scholer (TimelineX)
11b12c3e07 models.RequestEncodingMixin._encode_files now takes bytearray as fp in addition to the currently supported bytes and str input. 2015-03-03 02:44:52 +01:00
Ian Cordasco
2669f0c0b1 Fix when packages are unvendored
When working these changes back upstream to pip, we realized that the
previous fix wasn't ideal since unvendoring the packages broke the
imports. For example, if urllib3 were unvendored, then the following
would fail:

    from requests.packages import urllib3
2015-02-28 23:04:24 -06:00
Ian Cordasco
9d8a57f2a2 Add a test to ensure the alias does not regress 2015-02-28 20:19:13 -06:00
Ian Cordasco
6ea3f2ada8 Only alias the imports for vendored dependencies
While discussion the issue, Donald Stufft (@dstufft) and I realized the
simplest solution is to simply add an alias per vendored dependency. The
resulting changes are simple and effective. It prevents the issue in
2.5.2 and 2.5.3 where the following would work:

    from requests.packages import webbrowser

This now appropriately raises an ImportError.

Closes #2465
2015-02-28 20:13:46 -06:00
Cory Benfield
461b740db6 Merge pull request #2459 from kennethreitz/release-notes/2.5.3
Update HISTORY and release version for 2.5.3
2015-02-24 16:32:15 +00:00
Ian Cordasco
628474d626 Update HISTORY and release version for 2.5.3 2015-02-24 10:30:17 -06:00
Cory Benfield
de674fc82c Merge pull request #2458 from kennethreitz/revert-2442-certs
Revert "Update certificate bundle."
2015-02-24 16:18:16 +00:00
Ian Cordasco
b58318163c Revert "Update certificate bundle." 2015-02-24 09:44:51 -06:00
Ian Cordasco
d8be2473d1 Update HISTORY and version for v2.5.2 2015-02-23 16:28:42 -06:00
Ian Cordasco
58e513579a Update urllib3 to 29aa09bde9c42cc9a8d79aac47ee3d362b438cca 2015-02-23 16:02:30 -06:00
Ian Cordasco
0b6d2e451b Merge pull request #2444 from Yasumoto/urllib_upgrade
Upgrade urllib3 to 490d3a227fadb626cd54a240b9d0922f849914b4
2015-02-23 16:01:06 -06:00
Cory Benfield
6f3c91b834 Merge pull request #2453 from requiredfield/master
document combination of repeated response headers
2015-02-21 10:20:57 +00:00
requiredfield
ed73d9e45d document combination of repeated response headers 2015-02-20 12:20:18 -06:00
Ian Cordasco
5a22d2060f Merge pull request #2450 from iKevinY/shields-badges
Update README to use Shields badges
2015-02-19 20:01:55 -06:00
Kevin Yap
344b51327c Update README to use Shields badges
Shields badges are friendlier to retina displays.
2015-02-19 11:10:55 -08:00
Joe Smith
62df872871 Upgrade urllib3 to 490d3a227fadb626cd54a240b9d0922f849914b4 2015-02-11 11:04:25 -08:00
Ian Cordasco
a5a314e8ee Merge pull request #2442 from Lukasa/certs
Update certificate bundle.
2015-02-10 13:05:56 -06:00
Cory Benfield
b86330d1f1 Update certificate bundle. 2015-02-10 19:03:59 +00:00
Ian Cordasco
69d9594338 Merge pull request #2440 from aquarion/patch-1
Update to use readthedocs.org instead of rtfd.org

The requests-toolbelt link can't mix HTTPS with the short domain rtfd.
2015-02-06 08:02:58 -06:00
Nicholas Avenell
291b6b24b7 Update to use readthedocs.org instead of rtfd.org
https://toolbelt.rtfd.org causes an SSL error because the wildcard SSL cert is for *.readthedocs.org.
2015-02-06 13:46:38 +00:00
Cory Benfield
426493f388 Merge pull request #2438 from colindickson/master
add a timeout value to connection_error_invalid_port test to accelerate failure
2015-02-04 07:01:10 +00:00
Colin Dickson
80aee7a225 add a timeout value to connection_error_invalid_port test to accelerate failure 2015-02-04 21:05:03 -05:00
Colin Dickson
ced6550a25 split test_connection_error into two distinct tests, and changed "unknown url" test URL since fooobarbangbazbing.httpbin.org currently gives a valid response. 2015-02-03 21:23:07 -05:00
Cory Benfield
c7beb703bf Merge pull request #2437 from tomscytale/docs_query_param_array
quickstart: using a list as a value in query params
2015-02-03 10:34:06 +00:00
Tom S
53f33eb473 quickstart: using a list as a value in query params 2015-02-03 09:19:30 +00:00
Cory Benfield
69b7c45c2e Merge pull request #2436 from colindickson/master
Fix for failing test: test_connection_error
2015-02-03 06:50:11 +00:00
Ian Cordasco
e644857877 Fix typo. Use smaller paragraphs. Add CVE list 2015-01-28 20:48:22 -06:00
Ian Cordasco
3a5e2b2f3d Add a missing comma 2015-01-28 08:58:43 -06:00
Ian Cordasco
02f852cc41 Add Cory's twitter account
Added some more detail to the Vulnerability section
2015-01-28 08:58:05 -06:00
Ian Cordasco
ff56e431ad Update support documentation to be more accurate
We were missing instructions to report security vulnerabilities,
and all of the documentation referred to Kenneth as the only
source of support. We were also missing a link to StackOverflow.
2015-01-28 08:16:05 -06:00
Kenneth Reitz
b137472936 Merge pull request #2393 from sigmavirus24/bug/2356
Attempt to quote anyway if unquoting fails
2015-01-27 10:24:34 -08:00
Kenneth Reitz
383b20b023 Merge pull request #2412 from sigmavirus24/remove-cruft
Remove entirely unnecessary and unused bits from requests.compat
2015-01-27 10:24:25 -08:00
Kenneth Reitz
3314eb9a62 Merge pull request #2413 from sigmavirus24/bug/2411
Check that filenames are unicode or bytes
2015-01-27 10:23:18 -08:00
Kenneth Reitz
cf3a7f4945 Merge pull request #2415 from sigmavirus24/bug/2408
Move noncebit to the only place it is used
2015-01-27 10:22:53 -08:00
Zhaoyu Luo
fb1971778f Bug fix: field uri in digest authentication should not be empty when encounter http redirections 2015-01-25 18:11:22 -06:00
Cory Benfield
2f7f6a57f3 Merge pull request #2420 from chriskuehl/master
Replace n-dash in HISTORY to workaround pip bug
2015-01-23 07:19:39 +00:00
Chris Kuehl
74d85d0a2f HISTORY: replace n-dash to workaround pip bug
There exists a problem (maybe a bug?) in pip when using a locale like
`LC_ALL=C` (which is commonly used by CI environments and system
configuration tools such as Puppet), where the PKG-INFO file is decoded
using ascii, raising a UnicodeDecodeError when PKG-INFO contains
non-ASCII characters (such as the n-dash removed by this commit):

> Downloading/unpacking requests from https://pypi.python.org/packages/source/r/requests/requests-2.5.1.tar.gz
>   Downloading requests-2.5.1.tar.gz (443Kb): 443Kb downloaded
>   Running setup.py egg_info for package requests
>
> Exception:
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 104, in main
>     status = self.run(options, args)
>   File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 245, in run
>     requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
>   File "/usr/lib/python3/dist-packages/pip/req.py", line 1014, in prepare_files
>     req_to_install.assert_source_matches_version()
>   File "/usr/lib/python3/dist-packages/pip/req.py", line 359, in assert_source_matches_version
>     version = self.installed_version
>   File "/usr/lib/python3/dist-packages/pip/req.py", line 351, in installed_version
>     return self.pkg_info()['version']
>   File "/usr/lib/python3/dist-packages/pip/req.py", line 318, in pkg_info
>     data = self.egg_info_data('PKG-INFO')
>   File "/usr/lib/python3/dist-packages/pip/req.py", line 261, in egg_info_data
>     data = fp.read()
>   File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode
>     return codecs.ascii_decode(input, self.errors)[0]
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 8161: ordinal not in range(128)

I'm not able to reproduce this by installing the package directly, only by
installing another package which depends on it (via `install_requires`).

The command I used was `LC_ALL=C /usr/bin/pip-3.2 install --upgrade ocflib`,
with "pip 1.1 from /usr/lib/python3/dist-packages (python 3.2)" (which
is the packaged version for Debian 7).

Although this should probably be addressed ultimately in pip, replacing
this character in HISTORY is a pain-free and pragmatic way to help
developers and system administrators who may be stuck with old versions
of pip for many years to come.
2015-01-22 19:45:49 -08:00
Ian Cordasco
eec44dbbb1 Check that a filename is a basestring instance
Instead of only checking one or another type of string-like object that
we accept, let's be able to check both. Previously, we only checked if
the filename was an instance of the native str type which on Python 2
excluded unicode filenames and bytes-like filenames on Python 3.

Fixes #2411
2015-01-20 20:44:52 -06:00
Ian Cordasco
677bbe30d7 Move noncebit to the only place it is used
Since we only allow for "auth" qop-value, hardcode it

Fixes #2408
2015-01-19 18:50:50 -06:00
Ian Cordasco
f37fe551bb Remove entirely unnecessary and unused bits from requests.compat 2015-01-18 21:17:11 -06:00
Ian Cordasco
751b35c346 Attempt to quote anyway if unquoting fails
Fixes #2356
2015-01-18 21:07:43 -06:00
Ian Cordasco
d2d576b6b1 Update urllib3 to a27758625e4169330fcf965652b1093faf5aaaa2 2015-01-09 20:55:54 -06:00
Kenneth Reitz
a57eacf080 Merge pull request #2375 from sigmavirus24/fix-imports-when-unbundled
Copy pip's import machinery wholesale
2015-01-09 15:38:30 -05:00
Kenneth Reitz
b176ccd481 drawn towards it rather than pushed away 2015-01-08 10:04:58 -05:00
Kenneth Reitz
176b365287 certifi 2015-01-08 10:01:39 -05:00
Kenneth Reitz
09658b80c0 certifi 2015-01-08 09:58:31 -05:00
Kenneth Reitz
ac34e3b346 simpler button 2015-01-08 09:55:40 -05:00
Kenneth Reitz
5549f50258 cleanups 2015-01-08 09:52:56 -05:00
Kenneth Reitz
15597c27cd Requests Pro 2015-01-08 09:52:50 -05:00
Kenneth Reitz
673bd6afce javascripts 2015-01-06 00:56:47 -05:00
Cory Benfield
7612015424 Merge pull request #2395 from shrayasr/happy-new-year
Changing year in all copyright information
2015-01-01 08:28:11 +00:00
Shrayas
892f2560c1 Changing year in all copyright information
- Happy new year! Thanks for this awesome library :)
2015-01-01 09:04:50 +05:30
Kenneth Reitz
2d1ffad80b Merge pull request #2390 from Lukasa/cookiedocs
Clean up cookie docstrings, document cookie jar.
2014-12-24 10:15:37 -05:00
Cory Benfield
101425ebfc Enhance documentation for clarity. 2014-12-24 14:54:49 +00:00
Cory Benfield
f4ec3d2309 Clean up cookie docs and display them. 2014-12-24 14:33:14 +00:00
Ian Cordasco
b83131779c Bump version to 2.5.1 2014-12-23 11:54:01 -06:00
Ian Cordasco
ce5b5fe227 Add release notes for 2.5.1 2014-12-23 11:50:31 -06:00
Ian Cordasco
eccbf4a412 Merge pull request #2389 from sigmavirus24/bug/fix-digest-auth
Fix bug in renegotiating a nonce with the server
2014-12-23 11:40:35 -06:00
Ian Cordasco
86c3ecfd34 Fix bug in renegotiating a nonce with the server
If a session runs long enough (without constant activity) then the server can
expire the nonce the session has negotiated. If that happens the session will
get a new 401 response which we were immediately returning to the user. A user
would then have to essentially reinitialize session.auth each time they get an
unexpected 401.

Also, there's no need for setattr calls when we can simply assign the
attribute on the instance.
2014-12-23 10:40:31 -06:00
Ian Cordasco
bd3cf95e34 Fix error handling on Python 3 2014-12-16 22:49:24 -06:00
Ian Cordasco
386c589ba0 Merge branch 'master' of https://github.com/ContinuousFunction/requests into pr/2344 2014-12-16 22:18:51 -06:00
Cory Benfield
f723ab538f Merge pull request #2382 from daftshady/exception
catch exception more specifically
2014-12-16 09:19:50 +00:00
daftshady
925e975295 catch exception more specifically in Response.ok 2014-12-16 16:55:13 +09:00
ContinuousFunction
4c61fef13f Uncommented test in test_requests.py
Uncommented test_sesion_pickling in test_requests.py and ran the file to
make sure the test passes.
2014-12-15 13:41:10 -05:00
ContinuousFunction
39090cfba6 Merge branch 'master' of https://github.com/kennethreitz/requests 2014-12-15 13:24:06 -05:00
Cory Benfield
d7c0249aa8 Merge pull request #2381 from namlede/patch-1
Fix a typo in a comment
2014-12-15 07:59:47 +00:00
Ben Edelman
01b58ba04e Fix a typo in a comment
I just fixed a minor typo: "throws" is misspelled as "thows".
2014-12-15 01:37:19 -05:00
Ian Cordasco
a8205bb509 Merge pull request #2379 from arthurdarcet/master
utils.guess_filename fails if the given parameter looks like a file object but has a non-string name attribute
2014-12-13 13:49:04 -06:00
Ian Cordasco
da82fb4b1d Give proper attribution to pip 2014-12-12 21:12:31 -06:00
Arthur Darcet
e8d02ea0bb utils.guess_filename fails if the given parameter looks like a file object but has a non-string name attribute
e.g. a cherrypy uploaded file behave like a regular file, except that its name attribute is an int and passing it directly to requests fails because of that
2014-12-12 17:32:43 +01:00
Ian Cordasco
d615405519 Copy pip's import machinery wholesale 2014-12-08 20:48:40 -06:00
Ian Cordasco
e23bf10cf4 Merge pull request #2374 from krvc/fix_link
Updated the broken link to twitter streaming API documentation
2014-12-08 17:46:08 -06:00
rakesh
508f4b1ca5 Updated the broken link to twitter streaming API documentation 2014-12-09 01:59:55 +05:30
Ian Cordasco
1d9bf43def Merge pull request #2373 from frewsxcv/patch-1
Enable GitHub syntax highlighting on README
2014-12-08 12:40:44 -06:00
Corey Farwell
bf2e73522f Enable GitHub syntax highlighting on README 2014-12-08 13:04:27 -05:00
Kenneth Reitz
4e90aa7bd0 Merge pull request #2363 from sigmavirus24/fix-tests
Update tests to work offline
2014-12-02 20:46:10 -08:00
Ian Cordasco
f172b30356 Merge pull request #2365 from sigmavirus24/release/2.5
Release v2.5.0
2014-12-01 17:22:17 -06:00
Ian Cordasco
33b25176b8 Bump version to 2.5.0 2014-12-01 17:03:24 -06:00
Ian Cordasco
9a0ce93935 Add updates for 2.5.0 2014-12-01 17:02:42 -06:00
Ian Cordasco
cf82d4406b Update tests to work offline 2014-12-01 16:21:41 -06:00
Kenneth Reitz
90857b8b59 Merge pull request #2216 from sigmavirus24/retries-take-2
Retries logic
2014-12-01 14:45:27 -05:00
Kenneth Reitz
7aa6c62d6d updatee chardet, urllib3 2014-12-01 14:40:32 -05:00
Kenneth Reitz
53d02381e2 Merge pull request #2349 from sigmavirus24/fix-pickling
Properly serialize RecentlyUsedContainers for cache
2014-11-30 14:12:43 -05:00
Kenneth Reitz
8ae4d02d73 Merge pull request #2348 from danmichaelo/master
Docs: Add more section labels for referencing
2014-11-30 14:12:04 -05:00
Kenneth Reitz
1c4a666b16 Merge pull request #2353 from mattrobenolt/patch-1
url was already parsed, don't urlparse twice
2014-11-30 14:11:52 -05:00
Matt Robenolt
2a5364cf72 url was already parsed, don't urlparse twice 2014-11-23 17:54:44 -08:00
Ian Cordasco
c8baf88125 Properly serialize RecentlyUsedContainers for cache
RecentlyUsedContainers are threadsafe so they require a lock and as such
cannot be serialized with pickle directly. To handle it, we need to
convert it to a dictionary first and then back when deserializing.

Fixes #2345
2014-11-17 22:16:32 -06:00
ContinuousFunction
3246b1fe17 Changed ConnectionError to InvalidURL 2014-11-17 20:06:24 -08:00
Dan Michael O. Heggø
8b03f60278 Docs: Add more section labels for referencing
so sections can be linked from other projects using Intersphinx
2014-11-17 11:39:33 +01:00
ContinuousFunction
087a27aba9 Partially addresses Issue #1572
Addresses the LocationParseError but not the DecodeError from
kennethreitz#1572. When running
test_requests.py, I got an error in test_session_pickling which resulted
in a TypeError. I'm not sure of the reason for the TypeError but I have
commented out that test.
2014-11-15 16:58:25 -08:00
Ian Cordasco
adf475ef82 Update HTTPAdapter docstring 2014-11-12 13:58:03 -06:00
Ian Cordasco
2eb7e3c80b Add last few changes and add a quick test 2014-11-12 13:56:28 -06:00
Ian Cordasco
f54a4e3de1 Update urllib3 to df4ec5cce1 2014-11-12 13:56:28 -06:00
Ian Cordasco
2bc7762cb6 Update how we handle retries to be consistent with documentation 2014-11-12 13:56:28 -06:00
Kenneth Reitz
9dc660269f Merge pull request #2309 from sigmavirus24/add-deprecation-warnings
Add DeprecationWarnings to inform users of plans
2014-11-12 12:36:03 -05:00
Kenneth Reitz
1601387cbe Merge pull request #2308 from kevinburke/read-timeout-retry
Note about read timeout errors and max_retries
2014-11-12 12:35:24 -05:00
Kenneth Reitz
45ef1f8eeb Merge pull request #2332 from asnelzin/fix-2329
Add overriding Content-Length
2014-11-12 12:34:48 -05:00
Kenneth Reitz
e4ddca0f8b Merge pull request #2326 from sigmavirus24/close-functional-sessions
Close sessions created in the functional API
2014-11-12 12:34:14 -05:00
Ian Cordasco
19b8e3042e Merge pull request #2333 from akitada/reinit-pos
Fix HTTPDigestAuth not to treat non-file as a file
2014-11-12 09:53:32 -06:00
Akira Kitada
67c505781c Fix HTTPDigestAuth not to treat non-file as a file
Ensure pos is set to None when the body is not a file
so that HTTPDigestAuth detects the type of the body correctly.
2014-11-13 00:51:35 +09:00
Alexander Nelzin
ee50afef59 Fixed. 2014-11-12 15:35:27 +03:00
Alexander Nelzin
34f6088c8f Added test for overriding Content-Length. 2014-11-12 15:23:23 +03:00
Ian Cordasco
431282e778 Merge pull request #2299 from mattrobenolt/master
Cap the redirect_cache size to prevent memory abuse
2014-11-07 14:18:41 -06:00
Ian Cordasco
3155bc9936 Close sessions created in the functional API
This is related to #1882 and #1685. By calling close on the session, we
clear the PoolManager operated by the Session and close all sockets.

Fixes #1882
Partially-fixes #1685
2014-11-07 08:55:18 -06:00
Ian Cordasco
1c52d15d97 Merge pull request #2323 from Lukasa/strict
Pass strict to urllib3.
2014-11-07 08:12:23 -06:00
Cory Benfield
f28bde7250 Pass strict to urllib3. 2014-11-07 09:19:18 +01:00
Kenneth Reitz
122c92e590 Merge pull request #2253 from yossigo/digest_redirect_fix
A fix for #1979: repeat HTTP digest authentication after redirect.
2014-11-01 10:04:29 -04:00
Kenneth Reitz
124c0940e9 Merge pull request #2317 from sigmavirus24/bug/2316
Use to_native_string instead of builtin_str
2014-11-01 10:04:09 -04:00
Ian Cordasco
29ef108158 Use to_native_string instead of builtin_str
Fixes #2316
2014-10-31 21:20:04 -05:00
Kevin Burke
a703e24573 Update documentation about max_retries to reflect code 2014-10-27 09:56:18 -07:00
Matt Robenolt
387c8f852c Cap the redirect_cache size to prevent memory abuse 2014-10-27 09:20:06 -07:00
Ian Cordasco
091991be0d Merge pull request #2306 from ssadler/fix-failing-test-test_prepare_unicode_url
Fix failing test test_prepare_unicode_url
2014-10-26 19:32:46 -05:00
Ian Cordasco
d505b94fa4 Add DeprecationWarnings to inform users of plans
After a long discussion in IRC and on several issues, the developers of
requests have decided to remove specific functions from requests.utils
in version 3.0.0. To give users ample time to prepare for this, we've
added DeprecationWarnings long in advance. See also the planning of this
in issue #2266.
2014-10-26 19:24:41 -05:00
Kevin Burke
f2f3bdea8d Note about read timeout errors and max_retries 2014-10-26 12:46:23 -07:00
Scott Sadler
583859b820 fix failing test "test_prepare_unicode_url" \(take 3\) 2014-10-26 14:45:12 +01:00
Scott Sadler
8e69c9f0a1 Revert "fix failing test "test_prepare_unicode_url""
This reverts commit 26ed7c2e1d.
2014-10-26 14:41:56 +01:00
Scott Sadler
26ed7c2e1d fix failing test "test_prepare_unicode_url" 2014-10-26 12:49:46 +01:00
Scott Sadler
77687de509 Revert "fix failing test "test_prepare_unicode_url""
This reverts commit cfd6e25749.
2014-10-26 12:40:05 +01:00
Kenneth Reitz
be805f942e Merge pull request #2295 from 2deviant/feature-custom-newline
Adding a custom line delimiter to iter_lines()
2014-10-25 14:33:52 -04:00
Scott Sadler
c044a70796 update AUTHORS 2014-10-25 16:52:02 +02:00
Scott Sadler
cfd6e25749 fix failing test "test_prepare_unicode_url" 2014-10-25 16:51:51 +02:00
Val Tenyotkin
3602690886 Changing parameter name newline ==> delimiter. 2014-10-24 16:37:35 -07:00
Yossi Gottlieb
3d8823cafc Clean up handle_redirect. 2014-10-23 13:46:44 +03:00
Val Tenyotkin
f5ff05be1e Adding a custom line delimiter to iter_lines() 2014-10-21 18:03:11 -07:00
Cory Benfield
6b58a359e8 Merge pull request #2290 from syedsuhail/fix-2282
Fix #2279. Update layout css
2014-10-19 10:42:28 +01:00
syedsuhail
96efb5ec96 Fix #2279. Update layout css 2014-10-19 14:06:02 +05:30
Cory Benfield
e1e1855b85 Merge pull request #2289 from syedsuhail/fix-2288
Fix #2288 . Change urllib3 and chardet workflow
2014-10-19 08:56:36 +01:00
syedsuhail
3a6348dbb9 Fix #2288. Change urllib3 and chardet workflow 2014-10-19 13:18:26 +05:30
Kenneth Reitz
f7ecad843b Merge pull request #2282 from morganthrapp/patch-1
Update sidebarintro.html
2014-10-14 11:22:48 -04:00
morganthrapp
4d498db3ed Update sidebarintro.html
Fix issue #2279. "Gittip" changed to "Gratipay". Tip button extended from 48px to 60px.
2014-10-14 10:56:05 -04:00
Kenneth Reitz
c41eb27091 Merge pull request #2273 from sigmavirus24/add-changelog-to-sidebar
Add Release History to the sidebar
2014-10-12 10:55:34 -04:00
Ian Cordasco
2ac771b35e Merge pull request #2271 from mikecool1000/fix-2250
Fixed #2250
2014-10-10 13:30:18 -05:00
Michael DeLay
8339b60fd5 Made more better 2014-10-10 09:58:30 -07:00
Ian Cordasco
589f2f6d6e Add Release History to the sidebar
Closes #2269
2014-10-09 21:07:05 -05:00
mikecool1000
ce1ac88543 Fixed #2250 2014-10-09 12:22:18 -07:00
mikecool1000
4594667f07 Update utils.py
Fixed -2250
2014-10-08 19:26:07 -07:00
Yossi Gottlieb
6ff6f756c0 Clean up, support all redirects, fix potential endless 401 loop. 2014-10-08 00:06:01 +03:00
Kenneth Reitz
46d646064c v2.4.3 2014-10-06 05:44:25 -04:00
Kenneth Reitz
78d12bbbe9 v2.4.3 2014-10-06 05:42:55 -04:00
Kenneth Reitz
6da438dabd Merge pull request #2268 from sigmavirus24/fix-params
Re-order params for backwards compat
2014-10-06 05:40:03 -04:00
Kenneth Reitz
4ec26da2f7 Merge pull request #2267 from minrk/unicode-url-py2
allow unicode URLs on Python 2
2014-10-06 05:39:54 -04:00
Ian Cordasco
0e4efab270 Re-order params for backwards compat 2014-10-05 18:55:59 -05:00
MinRK
ca2ebc5b68 allow unicode URLs on Python 2
on Python 2 u'é'.decode('utf8') fails with UnicodeEncodeError,
but only AttributeError is caught.

This only calls decode on known bytes objects.
2014-10-05 16:30:11 -07:00
Kenneth Reitz
5850b1f53b Merge pull request #2249 from t-8ch/fix_2247
fix #2247
2014-10-05 13:19:14 -04:00
Kenneth Reitz
779c001e44 requests v2.4.2 2014-10-05 13:15:33 -04:00
Kenneth Reitz
79f56e2e7e fix documentation for utils.get_unicode_from_response() :) 2014-10-05 13:14:38 -04:00
Kenneth Reitz
90dc467fc0 v2.4.2 changelog 2014-10-05 13:13:42 -04:00
Kenneth Reitz
65cdccb70f Merge pull request #2241 from tijko/master
raise RuntimeError when a single streamed request calls *iter methods th...
2014-10-05 12:48:40 -04:00
Kenneth Reitz
1e79cf6a47 Merge pull request #2258 from willingc/add-json
Add json parameter
2014-10-05 12:46:09 -04:00
Cory Benfield
20ca9feeb3 Merge pull request #2265 from sigmavirus24/session-attrs
Remove timeout from __attrs__
2014-10-05 09:05:29 +01:00
Ian Cordasco
b1f3a2dd66 Remove timeout from __attrs__
We do not allow the user to set the timeout value on the Session any longer so
this is extraneous
2014-10-04 23:04:36 -05:00
Kenneth Reitz
e74791d054 Merge pull request #2238 from buttscicles/byte-urls
Support bytestring URLs on Python 3.x
2014-10-02 12:20:05 -04:00
Ian Cordasco
8ed941fa69 Fix a couple of issues I noticed
- Don't _ prefix json in prepare_body
- Don't initialize json to []
- Don't initialize json to {}
- Reorder parameters to PreparedRequest.prepare
- Remove extra parentheses
- Update docstring
2014-09-30 16:03:31 -05:00
Joe Alcorn
a68d1b4517 Support bytestring URLs on Python 3.x 2014-09-30 19:29:10 +01:00
Yossi Gottlieb
c28da22e9c A fix for #1979 repeat HTTP digest authentication after redirect. 2014-09-27 21:05:59 +03:00
Thomas Weißschuh
cd5eb62961 remove unused import 2014-09-26 22:28:29 +00:00
Thomas Weißschuh
6e1db21733 fix #2247
We have to pass urllib3 the url without the authentication information,
else it will be parsed by httplib as a netloc and included in the request line
and Host header
2014-09-25 19:49:28 +00:00
Cory Benfield
a718a81d27 Merge pull request #2248 from jktjkt/docs-CAs
docs: Clarify how to pass a custom set of CAs
2014-09-25 19:28:05 +01:00
Jan Kundrát
3635b1501d docs: Clarify how to pass a custom set of CAs
This new wording makes it hopefully easier to find how to override the
system-provided list of trusted CAs. I failed to find this through some googling
and had to resort to asking on IRC previously.
2014-09-25 20:06:04 +02:00
Kenneth Reitz
de76fbeefb Merge pull request #2244 from sigmavirus24/bug/2231
Avoid getting stuck in a loop
2014-09-24 22:57:38 -04:00
Cory Benfield
e0d88c2814 Merge pull request #2245 from sigmavirus24/doc-fix
Correct redirection introduction
2014-09-23 07:25:26 +01:00
Ian Cordasco
671ba85d41 Correct redirection introduction
The history attribute contains responses, not requests.

Thanks to Yang Yang for reporting this to me via email
2014-09-22 21:08:29 -05:00
Ian Cordasco
ac44b48297 Avoid getting stuck in a loop
This prevents a case where we make a request to URL A, which 301s to B which
would then 301 back to A. Alternatively, for less simple schemes, this will
also prevent us from getting stuck in a loop, e.g., it will prevent the
following from causing an endless loop:

    A -> B -> C -> D -> E -> F --
    ^                             \
    |                             /
    ---<------------<----------<-
2014-09-22 21:01:36 -05:00
Tim Konick
64ba451049 make StreamConsumedError doubly inherit 2014-09-22 15:58:54 -04:00
Tim Konick
6e5f7bb9d3 using the StreamConsumedError 2014-09-22 15:51:59 -04:00
Tim Konick
58e0a6f4a0 add-in StreamConsumedError 2014-09-22 15:51:10 -04:00
Tim Konick
d6470870d0 rm else after if then raise block 2014-09-22 12:46:07 -04:00
Tim Konick
fdf932c61c raise RuntimeError when a single streamed request calls *iter methods than once 2014-09-22 12:04:29 -04:00
Cory Benfield
d28d45af91 Merge pull request #2237 from buttscicles/contributing-update
Remove invoke from requirements.txt, docs
2014-09-20 23:12:38 +01:00
Joe Alcorn
d243668d16 Remove invoke from requirements.txt, docs 2014-09-20 20:56:00 +01:00
Cory Benfield
466a70f7c1 Fixup the remaining references to timeline.json. 2014-09-20 15:00:36 +01:00
Kenneth Reitz
082c8d0db8 Merge pull request #2227 from mjul/master
Added example of how to send multiple files in one request.
2014-09-18 10:06:54 +09:00
Martin Jul
0924069b68 Moved multiple files upload example to advanced section. 2014-09-16 11:54:31 +02:00
Martin Jul
4707d11004 Added example of how to send multiple files in one request. 2014-09-16 11:38:40 +02:00
Ian Cordasco
9b41308b9f Merge pull request #2223 from blueyed/doc-followup-2222
Document skipping in PreparedRequest; followup to #2222
2014-09-12 11:54:40 -05:00
Daniel Hahler
bff8b91638 Document skipping in PreparedRequest; followup to #2222 2014-09-12 18:07:28 +02:00
Cory Benfield
1a44a99f17 Merge pull request #2222 from blueyed/fix-MissingScheme-for-hostport
Add tests to test_invalid_url for `InvalidSchema`
2014-09-12 15:16:11 +01:00
Daniel Hahler
d3566ee1b0 Add more tests to test_invalid_url
This adds tests for the behavior introduced in b149be5d, where
`PreparedRequest` was made to skip `parse_url` for e.g.
`localhost:3128/`.
2014-09-12 16:11:30 +02:00
Kenneth Reitz
9e8702d3d5 lawl 2014-09-09 12:42:00 -04:00
Kenneth Reitz
27b6bfc213 mils 2014-09-09 12:39:36 -04:00
Kenneth Reitz
dff383ce8f requests v2.4.1 2014-09-09 12:34:34 -04:00
Cory Benfield
5e94c81e98 Merge pull request #2210 from sigmavirus24/bug/2207
Fix #2207
2014-09-09 15:24:24 +01:00
Cory Benfield
2416e2343a Merge pull request #2213 from kennethreitz/req-rsp
Request->Response.
2014-09-09 08:45:30 +01:00
Cory Benfield
bf8f791a93 Request->Response. 2014-09-09 08:44:40 +01:00
Ian Cordasco
27c83f7177 Fix #2207
@Lukasa wrote the fix in #2207
2014-09-07 12:02:23 -05:00
Kenneth Reitz
359659cf4b Merge pull request #2203 from Lukasa/remove_certifi
Remove hard certifi dependency and document.
2014-09-05 08:11:57 -07:00
Cory Benfield
9c6ae1dc0b Link to Mozilla trust store. 2014-09-04 19:44:37 +01:00
Kenneth Reitz
0df32de02d Merge pull request #2199 from mtorromeo/patch-1
Open README and HISTORY as utf-8 encoded files (fixes #2196)
2014-09-04 11:41:46 -07:00
Cory Benfield
a77054f90f Remove hard certifi dependency and document. 2014-09-04 19:40:15 +01:00
Kenneth Reitz
1324ca1a0f Merge pull request #2193 from sigmavirus24/bug/2192
Capture and re-raise urllib3 ProtocolError
2014-09-04 11:39:41 -07:00
Kenneth Reitz
209a871b63 Merge pull request #2191 from kevinburke/comma
add trailing comma
2014-09-04 11:39:23 -07:00
Kenneth Reitz
07bbe214aa Merge pull request #2187 from kevinburke/more-docs
Document Timeout behaviour
2014-09-04 11:39:12 -07:00
Kenneth Reitz
958845ae35 requests[security] 2014-09-04 11:37:45 -07:00
Kenneth Reitz
bc2560480e Merge pull request #2195 from sigmavirus24/betterssl
Add betterssl extra
2014-09-04 11:36:56 -07:00
Ian Cordasco
9354855648 Consolidate error handling 2014-09-03 16:01:25 -05:00
Massimiliano Torromeo
226b5c7b0a Open README and HISTORY as utf-8 encoded files (fixes #2196) 2014-09-03 09:40:27 +02:00
Ian Cordasco
ce7957c085 Add test for invalid port 2014-08-29 16:50:45 -05:00
Ian Cordasco
c6a1167e8b Merge remote-tracking branch 'kevinburke/domain-failure-connection-error' into bug/2192 2014-08-29 16:43:51 -05:00
Ian Cordasco
c809867035 Add betterssl extra 2014-08-29 16:39:22 -05:00
Kevin Burke
2c76122a48 Add test that invalid domain raises a ConnectionError 2014-08-29 14:07:28 -07:00
Ian Cordasco
da122231e4 Capture and re-raise urllib3 ProtocolError 2014-08-29 15:16:30 -05:00
Kevin Burke
34ea836d77 tildes 2014-08-29 12:08:03 -07:00
Kevin Burke
59f5a1089a add trailing comma 2014-08-29 12:06:58 -07:00
Kevin Burke
81d6b3e435 s/behavior/behaviour 2014-08-29 11:51:09 -07:00
Kevin Burke
dfa41afd43 Document Timeout behaviour 2014-08-29 11:50:11 -07:00
Kenneth Reitz
95161ed313 v2.4.0 changelog 2014-08-29 10:32:18 -04:00
Kenneth Reitz
1fcda912db Revert "Documentation update : connection keep alive"
This reverts commit 1b2602344f.

Conflicts:
	docs/user/advanced.rst
2014-08-29 10:30:49 -04:00
Carol Willing
0713e09526 Fixes typo in test 2014-08-28 19:42:21 -07:00
Carol Willing
402f3b4993 Changes check on base and json. Fails on tests. 2014-08-28 19:27:45 -07:00
Carol Willing
b34a496649 Adds review changes 2014-08-28 16:45:24 -07:00
Carol Willing
8f17741849 Adds json parameter for POST requests 2014-08-28 12:53:19 -07:00
Kenneth Reitz
d22b8d8e7e 3.4 classifier 2014-08-28 13:10:26 -04:00
Kenneth Reitz
d33ce49aaa keep-alive 2014-08-28 13:05:30 -04:00
Kenneth Reitz
89cb408bb0 v2.4.0 2014-08-28 13:05:23 -04:00
Kenneth Reitz
5f483369aa Merge pull request #2178 from sigmavirus24/env-retrieval
Add Session method to merge environment settings with per-request settings
2014-08-26 15:44:51 -04:00
Kenneth Reitz
7e24176ca1 Merge pull request #2183 from Lukasa/docupdate
Fix #2180.
2014-08-26 15:41:44 -04:00
Cory Benfield
08d8876230 Remove timeline.json from docs. 2014-08-26 20:20:34 +01:00
Ian Cordasco
596ca83f0c Update verify check and doc-string 2014-08-26 14:20:19 -05:00
Ian Cordasco
b4a7906bca Add Session method to merge environment settings with per-request settings 2014-08-26 14:20:19 -05:00
Kenneth Reitz
7a09e727e3 Merge pull request #2174 from kevinburke/test-clarification
Clarify which tests to run in the Makefile
2014-08-26 15:15:28 -04:00
Kenneth Reitz
32e403a908 Merge pull request #2176 from kevinburke/connect
Add support for connect timeouts
2014-08-26 15:13:30 -04:00
Kenneth Reitz
c879873b3e Merge pull request #2179 from kevinburke/urllib3-pypy-ssl
Updates urllib3 to 528ad3c
2014-08-26 15:10:51 -04:00
Kevin Burke
8bbc4fcb57 Updates urllib3 to 528ad3c
This includes fixes for openssl running with Pypy, so SSL connections can be
made if ndg-httpsclient, pyopenssl and pyasn1 are installed.

see also:

- https://github.com/shazow/urllib3/issues/449
- https://github.com/pypa/pip/issues/1988
2014-08-25 13:44:29 -07:00
Kevin Burke
7f236fcc40 woops 2014-08-24 20:22:55 -07:00
Kevin Burke
39b3a436d3 assert connect timeout inheritance 2014-08-24 20:18:05 -07:00
Kevin Burke
8f9ce13e43 ConnectTimeout multiple inheritance 2014-08-24 19:56:57 -07:00
Kevin Burke
f0b9b60f62 revert change 2014-08-24 19:46:46 -07:00
Kevin Burke
c2aeaa3959 Add support for connect timeouts
Modifies the timeout interface to also accept a tuple (connect, read) which
would be used to set individual connect and read timeouts for Requests. Adds
Advanced documentation explaining the interface and providing guidance for
timeout values.
2014-08-23 15:12:29 -07:00
Kevin Burke
024db279c4 clarify comment 2014-08-23 10:10:44 -07:00
Kevin Burke
e70179a620 Clarify which tests to run in the Makefile
If you put your Virtualenv in the same folder as Requests (as I
usually do), py.test will pick up any test_* files inside the
virtualenv and attempt to run them too, leading to the following error:
https://gist.github.com/kevinburke/1aa2b07e01de3a7daa15

Instead specify the test file we would like to run in the Makefile.
2014-08-23 10:02:27 -07:00
Kenneth Reitz
c0322e490b Merge pull request #2172 from ContinuousFunction/master
Add to authors and fix case
2014-08-22 09:04:50 -04:00
Cory Benfield
1c20d01f10 Cleanup grammar from previous commit. 2014-08-22 11:50:37 +01:00
Cory Benfield
391e064b8f Merge pull request #2173 from tychotatitscheff/master
Documentation update : connection keep alive
2014-08-22 11:47:35 +01:00
tat3657
1b2602344f Documentation update : connection keep alive 2014-08-22 10:39:05 +02:00
ContinuousFunction
337b338187 Adding my name to authors 2014-08-21 11:25:29 -07:00
ContinuousFunction
5aa1881959 Adding myself to authors. 2014-08-21 11:16:59 -07:00
ContinuousFunction
8bb8a9a37c Adding my name to authors. 2014-08-21 11:12:36 -07:00
ContinuousFunction
c7e087cf56 Added space and sentence case
Added space and sentence case as requested by sigmavirus24.
https://github.com/kennethreitz/requests/pull/2168
2014-08-21 11:05:02 -07:00
Kenneth Reitz
aa6650a2e7 Merge pull request #2168 from ContinuousFunction/master
Tracking Previous Requests
2014-08-21 13:43:23 -04:00
ContinuousFunction
2fc6e8a894 Update on Tracking Previous Requests
Modified the comment in sessions.py and rewrote the test in
test_requests.py
2014-08-19 10:51:26 -07:00
Kenneth Reitz
53d3cece00 21m 2014-08-19 12:53:26 -04:00
ContinuousFunction
df641e74ff Tracking Previous Requests
Addresses the issue brought up here:
https://github.com/kennethreitz/requests/issues/1929
2014-08-17 19:13:26 -07:00
Kenneth Reitz
35d083e166 Merge pull request #2153 from jschneier/master
handle urllib3 api changes; closes #2045
2014-08-01 21:33:55 -04:00
Josh Schneier
47d0517d66 handle urllib3 api changes; closes #2045 2014-07-29 23:29:21 -04:00
Kenneth Reitz
3eb69be879 Merge pull request #2148 from romanlevin/handle-socket-error-in-iter_content
Handle socket errors in iter_content
2014-07-27 09:59:08 -04:00
Roman Levin
cf01a743af Replace setattr 2014-07-24 23:30:11 +02:00
Roman Levin
9eab9f7415 Handle socket errors in iter_content 2014-07-24 23:00:50 +02:00
Kenneth Reitz
fe693c4922 Merge pull request #2142 from sigmavirus24/urllib3-1.9
Upgrade urllib3 to 1.9.x
2014-07-22 16:21:05 -04:00
Kenneth Reitz
9575d6a6ce Merge pull request #2145 from TkTech/patch-1
Update faq.rst
2014-07-22 16:20:37 -04:00
Tyler Kennedy
35f7bcdaa2 Update faq.rst
Revised wording based on feedback from @sigmavirus24
2014-07-22 13:10:40 -04:00
Tyler Kennedy
57b861148e Update faq.rst
Removed an unnecessary "to" in the "What are "hostname doesn't match" errors?" section.
2014-07-22 12:38:08 -04:00
Cory Benfield
eb2906a65c Merge pull request #2140 from dpursehouse/linkify-usernames
Linkify Github usernames in authors list
2014-07-22 07:57:25 +01:00
Ian Cordasco
170d6269eb Fix test bug courtesy of @shazow 2014-07-21 15:00:14 -05:00
Ian Cordasco
811ee4eb5d Upgrade urllib3 to 1.9.x 2014-07-21 13:37:10 -05:00
Cory Benfield
e66466a331 Merge pull request #2141 from esparta/master
Docs: Using print() function instead print command on advanced & quickstart
2014-07-18 21:17:43 +01:00
Espartaco Palma
698b93b86d Docs: Using print() function instead print command on advanced & quickstart user docs 2014-07-18 11:44:57 -05:00
David Pursehouse
eef4e0836c Add links to Twitter accounts
Change-Id: Ic88eb128384b3cc9108151c219cd759c7524a4f1
2014-07-18 22:46:19 +09:00
Cory Benfield
4c94282fdf Merge pull request #2139 from dpursehouse/line-wrapping
More line wrapping
2014-07-18 10:59:48 +01:00
David Pursehouse
743f38209d Linkify Github usernames in authors list
- Linkify github usernames
- Remove usernames that do not exist

Change-Id: Ib88b70a3010e915b3570ae5062c8cb416c9a6462
2014-07-18 17:00:00 +09:00
David Pursehouse
44e426e4ff More line wrapping
Change-Id: I950c3da727fb97b58d96a872b0d2ed718cc60ba8
2014-07-18 16:35:54 +09:00
Cory Benfield
587a5153f0 Merge pull request #2138 from dpursehouse/more-doc-updates
More doc updates
2014-07-18 08:24:27 +01:00
David Pursehouse
be453ba3c3 Remove empty 'internals' page
The file is empty and not linked from anywhere, resulting in
a warning when building the docs.

Change-Id: Ib995d094ef525496fe8b2a369e0a0c5b4c7bd2dd
2014-07-18 15:19:32 +09:00
David Pursehouse
17852784e8 Remove redundant sentence from quickstart introduction
Change-Id: Ic03aa394941367745f3148d299b5313849f77051
2014-07-18 15:18:20 +09:00
David Pursehouse
c6fa5bb1cd Fix a couple more malformed :meth: and :class: links
Change-Id: Ie38844a40ec7a483e6ce5e56077be344242bcd99
2014-07-18 15:15:54 +09:00
David Pursehouse
49ecffb86e Add authentication classes to the API document
Change-Id: Ic1464f246602b809f3c29fbafd6f36b747d5d5df
2014-07-18 15:15:54 +09:00
Ian Cordasco
999ba49611 Merge pull request #2136 from dpursehouse/greenfeld-not-greenfield
Fix name misspelling
2014-07-16 07:14:36 -05:00
David Pursehouse
f0fb20cd83 Fix name misspelling
Change-Id: Ied3e600e5673eff48558b634b3c2616d13a3337b
2014-07-16 15:13:11 +09:00
Cory Benfield
e25fbc879e Merge pull request #2135 from dpursehouse/fix-meth-and-class-directives
Docs: Fix :class: and :meth: directives
2014-07-16 06:36:40 +01:00
David Pursehouse
2a6303e018 Docs: Fix :class: and :meth: directives
A few instances of the directives were malformed and did not
result in hyperlinks in the generated HTML.

Change-Id: I94d93de928ee4ff24a48797baf2ac77598a20704
2014-07-16 10:50:57 +09:00
Ian Cordasco
d21916c0ff Merge pull request #2134 from nonZero/patch-1
removed unneeded parentheses from if clause
2014-07-15 12:13:09 -05:00
Ian Cordasco
54fc8075e6 Merge pull request #2133 from esparta/master
Update link to pip site on docs/user/install.rst
2014-07-15 12:12:49 -05:00
Udi Oron
6dc13f2194 removed unneeded parentheses from if clause 2014-07-15 19:56:47 +03:00
Cory Benfield
127ab0a9f6 Merge pull request #2131 from dpursehouse/quickstart-doc-updates
Quickstart doc updates
2014-07-15 11:40:28 +01:00
David Pursehouse
a8a4c9828a Restructure "Redirection and History" section in quickstart documentation
Change-Id: Ida38d551e8cd0edaeb92d09de411a6f4a3d0578b
2014-07-15 18:44:13 +09:00
David Pursehouse
f5a2138e8c Minor tidy-ups in quickstart documentation
Change-Id: Ia862c17707a2a76182c549db88821636e8402729
2014-07-15 18:27:50 +09:00
David Pursehouse
cde5a4a5d5 Add Timeout exception in API documentation
The Timeout exception is referenced from quickstart.rst but does
not get hyperlinked.

Change-Id: I69ad881bf9d2475c6239ac7b17f68ddbce0d03cd
2014-07-15 18:27:38 +09:00
Cory Benfield
55df62954b Merge pull request #2130 from dpursehouse/doc-index-updates
Doc index updates
2014-07-15 09:57:47 +01:00
David Pursehouse
504b960fb4 Documentation: Add Sony to list of users
Change-Id: I0568f27562e5d12f7e5e528b216ca1b1e9cd8256
2014-07-15 17:53:18 +09:00
David Pursehouse
d9ea1aaeb0 Documentation: Wrap lines in index.rst
Wrap lines at 80 characters where possible.

Change-Id: Ib254734a7a18b62f965577c368929058258b489f
2014-07-15 17:53:14 +09:00
Ian Cordasco
28d1ef5be9 Merge pull request #2128 from tshepang/patch-1
Fix broken link
2014-07-14 09:39:19 -05:00
Tshepang Lekhonkhobe
36b6c37496 Fix broken link 2014-07-14 16:13:23 +02:00
Kenneth Reitz
e48b4b492d Merge pull request #2124 from Lukasa/certifi
Depend on certifi
2014-07-11 13:30:07 -04:00
Cory Benfield
52facc7984 Install certifi with requests. 2014-07-10 21:49:31 +01:00
Cory Benfield
7a51337ce0 Preferentially use certifi to requests. 2014-07-10 21:49:16 +01:00
Espartaco Palma
291bc9ea07 Update link to pip site on docs/user/install.rst 2014-07-04 11:42:56 -05:00
Kenneth Reitz
39f0c66cbe Merge pull request #2115 from sigmavirus24/fix-2092
Update how we check verify when inspecting env variables
2014-07-03 09:35:55 -04:00
Ian Cordasco
3957b0befb Fix silly check 2014-07-02 10:42:00 -05:00
Cory Benfield
538a41e70d Merge pull request #2116 from sigmavirus24/fix-2107
Replace dead link with StackOverflow answer
2014-07-02 16:41:14 +01:00
Ian Cordasco
d25280dc20 Replace dead link with StackOverflow answer 2014-07-02 10:34:25 -05:00
Ian Cordasco
84f67379c8 Update how we check verify when inspecting env variables 2014-07-02 10:26:15 -05:00
Ian Cordasco
de2cd2e9c8 Merge pull request #2112 from np-csu/patch-1
Update quickstart.rst
2014-06-29 08:31:23 -05:00
np-csu
1bf4af6395 Update quickstart.rst
line 394: correct an input error.
2014-06-29 21:05:04 +08:00
Kenneth Reitz
b9bbfa659f Merge pull request #2049 from codedstructure/adapter-proxy_manager_for
Separated out proxy_manager_for to fix #2048
2014-06-23 12:11:13 -07:00
Cory Benfield
fcb735fd99 Merge pull request #2097 from bkerensa/patch-1
Update out-there.rst
2014-06-15 09:19:34 +01:00
Benjamin Kerensa
c451dd2c77 Update out-there.rst
Remove french blog post which is now a deadlink.
2014-06-15 00:10:09 -07:00
Kenneth Reitz
6b21e5c8f0 Merge pull request #2095 from ericfrederich/redirect_cache
Redirect cache
2014-06-12 14:42:41 -04:00
Eric L Frederich
493697a0aa Merge branch 'master' into redirect_cache 2014-06-12 08:25:33 -04:00
Eric L Frederich
c3444f8c7a don't make duplicate requests for permanent redirects 2014-06-12 08:25:21 -04:00
Kenneth Reitz
2c262de0fe Merge pull request #2090 from ericfrederich/fix_308
handle 308 redirection the same as 301 and 302
2014-06-12 00:19:44 -04:00
Kenneth Reitz
b80ed77cdd Update index.rst 2014-06-11 16:40:23 -04:00
Eric L Frederich
da3178f377 Re-add resume to not break existing apps
as requested by Cory Benfield
2014-06-11 13:27:36 -04:00
Eric L Frederich
ec3a2e6f04 rename resume/resume_incomplete to permanent_redirect according to rfc7238
Use temporary_redirect intead of temporary_moved to make the words
line up nicely ;-)
2014-06-11 11:08:10 -04:00
Eric L Frederich
07d9b730b7 handle 308 redirection the same as 301 and 302 2014-06-10 16:30:17 -04:00
Kenneth Reitz
743ce8119b Merge pull request #2088 from jeffknupp/master
various pep-8 cleanups; remove unsused imports; remove unused variables
2014-06-10 12:02:21 -04:00
Jeff Knupp
bff65f42ee Update with style considerations by @kennethreitz 2014-06-10 11:16:24 -04:00
Jeff Knupp
e2c4da7dd2 various pep-8 cleanups; remove unsused imports; remove unused variables 2014-06-10 09:09:33 -04:00
Kenneth Reitz
3ee781b895 Merge pull request #2076 from Lukasa/basic
Basic Auth handler sets unicode header value on Python 2
2014-06-09 10:53:23 -04:00
Ian Cordasco
326f6adcfa Merge pull request #2087 from Lukasa/2616
Update trivial mentions to RFC 2616.
2014-06-08 09:44:26 -05:00
Ben Bass
046302c0cb indentation change for code review 2014-06-08 15:23:37 +01:00
Cory Benfield
2b8353d3b3 Avoid unnecessary encode/decode cycles. 2014-06-08 10:28:35 +01:00
Cory Benfield
d977ee8a24 Force basic auth strings to native string type 2014-06-08 10:20:32 +01:00
Cory Benfield
22433163b3 Update trivial mentions to RFC 2616. 2014-06-07 09:53:12 +01:00
Kenneth Reitz
702283093a v2.3.1 changelog 2014-05-30 13:36:18 -04:00
Kenneth Reitz
75cd0a9bd9 Merge pull request #2078 from dgouldin/2077
Allow copying of PreparedRequests without headers/cookies
2014-05-30 13:33:29 -04:00
David Gouldin
32f600b083 Allow copying of PreparedRequests without headers/cookies 2014-05-30 10:11:53 -07:00
Kenneth Reitz
69996114d9 Merge pull request #2072 from sigmavirus24/fix-urlencoded-bytes
Check for basestring, not just str
2014-05-29 10:39:42 -04:00
Cory Benfield
785e4ab360 Merge pull request #2074 from Lukasa/filedoc
Ensure that we open files in binary mode in the docs.
2014-05-28 17:01:10 +01:00
Cory Benfield
a2413e010f Ensure that we open files in binary mode. 2014-05-28 16:59:57 +01:00
Ian Cordasco
5ab79e2514 Remove unnecessary check for builtin_str 2014-05-28 08:17:18 -05:00
Ian Cordasco
3faff0b8ea Check for basestring, not just str
Fixes #2071
2014-05-27 20:29:44 -05:00
Kenneth Reitz
6c72509f5b Merge pull request #2059 from jschneier/master
remove unused IteratorProxy
2014-05-27 11:28:11 -04:00
Kenneth Reitz
e71282394c Merge pull request #2064 from mgeisler/simplejson-syntax-error-import
compat: handle SyntaxError when importing simplejson
2014-05-27 11:25:54 -04:00
Kenneth Reitz
ddd748e67a Merge pull request #2065 from mgeisler/tox
Fix Python 3.2 compatibility in tests
2014-05-27 11:24:47 -04:00
Kenneth Reitz
0d40d97d3e Merge pull request #2069 from Lukasa/request
Document and initialise Response.request
2014-05-27 11:11:21 -04:00
Cory Benfield
3346ad1134 Document and initialise Response.request 2014-05-26 16:40:45 +01:00
Martin Geisler
c8916a08de test: restore Python 3.2 compatibility
The tests were broken because they used the u'...' Unicode literal
syntax which disappeared in Python 3.0 to 3.2.

We can work around this by conditionally defining a "u" function which
will produce a Unicode literal on Python 2.x. This is basically the
same approach as taken by the six library often used for writing
cross-version compatible code.
2014-05-26 16:20:39 +02:00
Martin Geisler
f4d1bbb7c5 faq: add Python 3.4 to list of supported Python versions
No code changes were necessary for this.
2014-05-26 16:20:03 +02:00
Martin Geisler
5eea4a3767 faq: mention that PyPy 2.2 works too
The FAQ says that PyPy 1.9 is supported. On my Debian Unstable, I can
install PyPy 2.2.1 and the tests work with that version too.
2014-05-26 16:19:17 +02:00
Martin Geisler
3b0fcb620d compat: handle SyntaxError when importing simplejson
We officially support Python 2.6 to 3.3, but simplejson does not
support Python 3.1 or 3.2:

  https://github.com/simplejson/simplejson/issues/66

Importing simplejson on Python 3.2 results in a SyntaxError because
simplejson uses the u'...' syntax (the syntax was not supported in
Python 3.0 to 3.2).

Support for loading simplejson instead of the stdlib json module was
added by #710:

  https://github.com/kennethreitz/requests/pull/710

No mention was made of the lack of support for Python 3.2, but it was
mentioned that simplejson can be faster than the stdlib json module.
2014-05-26 00:56:35 +02:00
Josh Schneier
7815953cb4 remove unused IteratorProxy 2014-05-23 11:52:17 -04:00
Ben Bass
54e96b40b7 allow pool_kwargs to be specified in init_poolmanager 2014-05-18 20:24:35 +01:00
Ben Bass
02618c8df5 improve proxy_manager_for re-usability by subclass 2014-05-18 20:10:35 +01:00
Ben Bass
e3d0ac7c9d update AUTHORS.rst 2014-05-17 23:22:15 +01:00
Ben Bass
f97e78726e Factor out HTTPAdapter.proxy_manager_for for #2048 2014-05-17 23:15:51 +01:00
Cory Benfield
a7c218480d Merge pull request #2047 from Hasimir/master
Fixed paragraph formatting in Urllib3/MIT License.
2014-05-17 16:37:31 +01:00
Ben McGinnes
eebae9c63b Fixed paragraph formatting in Urllib3/MIT License. 2014-05-18 01:16:27 +10:00
Ian Cordasco
c43ecd1c47 Merge pull request #2046 from alex/patch-2
Fixed a typo
2014-05-16 16:05:41 -05:00
Kenneth Reitz
76c09e7076 ignot dist 2014-05-16 15:30:48 -04:00
Alex Gaynor
53d3519a35 Fixed a typo 2014-05-16 14:11:05 -04:00
Kenneth Reitz
6366d3dd19 v2.3.0 2014-05-16 13:55:47 -04:00
Kenneth Reitz
b26c85f081 history update 2014-05-16 13:55:06 -04:00
Kenneth Reitz
343db40375 Merge remote-tracking branch 'origin/master' 2014-05-16 13:44:21 -04:00
Kenneth Reitz
bbed65d100 Merge pull request #2040 from Lukasa/clog
Initial 2.3.0 changelog.
2014-05-16 10:37:32 -04:00
Cory Benfield
24986f853c Merge pull request #2041 from pawroman/patch-1
Fix typo in advanced.rst docs
2014-05-13 11:31:24 +01:00
Paweł Romanowski
a7e7241616 Fix typo in advanced.rst docs
`Sesssion` -> `Session`
2014-05-13 10:11:40 +02:00
Kenneth Reitz
739d153ef7 Merge pull request #1944 from schlamar/redirect-decoding
Catch errors while handling redirects
2014-05-12 16:50:33 -04:00
schlamar
16459910a9 Added test for redirect with wrong gzipped header. 2014-05-12 22:45:45 +02:00
schlamar
5e860c08d8 Added test case to handle response of streamed redirects.
Credits go to @zackw.
2014-05-12 22:45:45 +02:00
schlamar
59c8d81381 Read content in Session.send instead of Adapter.send. 2014-05-12 22:42:54 +02:00
schlamar
c2a1f28a2e Catch possible exceptions while consuming content of redirect responses. 2014-05-12 22:42:53 +02:00
Cory Benfield
679ab5bc20 Initial 2.3.0 changelog. 2014-05-12 20:30:10 +01:00
Kenneth Reitz
c15a8f8a3d CaseInsensitiveDict now looks like a normal dict 2014-05-12 15:10:15 -04:00
Kenneth Reitz
5893cfcd90 Merge pull request #1972 from avidas/response_str
Add __str__ to case insensitive dict
2014-05-12 15:08:31 -04:00
Kenneth Reitz
c023f06aad Merge pull request #1924 from schlamar/proxy-default-scheme
Default proxy scheme to HTTP
2014-05-12 15:05:56 -04:00
Kenneth Reitz
569cd23c00 Merge pull request #1937 from jaraco/master
Improved decoding support for Response.iter_content and iter_lines
2014-05-12 15:04:35 -04:00
Kenneth Reitz
be2674bf3c Merge pull request #2038 from dstufft/update-urllib3
Update urllib3 to 4fb351cd2
2014-05-12 14:50:36 -04:00
Donald Stufft
626c48e947 Update urllib3 to 4fb351cd2 2014-05-12 14:43:50 -04:00
Cory Benfield
07f9a7ea02 Remove references to not-yet-made 2.3.0 release. 2014-05-03 10:59:14 +01:00
Kenneth Reitz
02a76b79a1 Merge pull request #2026 from Lukasa/updateurllib3
ImportError: No module named 'requests.packages.urllib3.util'
2014-05-02 15:09:39 -04:00
Kenneth Reitz
8f12f948b1 Merge pull request #2032 from dstufft/patch-1
Remove the easy_install section
2014-05-02 15:09:21 -04:00
Donald Stufft
31762899a0 Remove the easy_install section
There's not a lot of good reason to actually call out easy_install at all.
Anyone who prefers it already knows it exists and everyone else should be
directed unambiguously towards pip.
2014-05-02 12:51:50 -04:00
Cory Benfield
b8049ba201 Add urllib3 util package to setup.py. 2014-04-29 18:50:38 +01:00
Kenneth Reitz
54541a9927 Merge pull request #2021 from Lukasa/proxies2
Don't repopulate proxies if we don't trust the environment.
2014-04-28 17:49:27 -04:00
Cory Benfield
142b26ea7b Clearer description of Response.close(). 2014-04-28 19:42:30 +01:00
Kenneth Reitz
7fa9799e28 sidebar update 2014-04-26 09:28:05 -04:00
Kenneth Reitz
3e568eb3b0 sidebar update 2014-04-26 09:27:06 -04:00
Cory Benfield
459f8dfccb Don't repopulate proxies if we don't trust the env. 2014-04-26 13:05:01 +01:00
Kenneth Reitz
dae4026c18 Merge pull request #2017 from Ayper/master
Update urllib to 1.8.2
2014-04-25 23:04:54 -04:00
apr
36b0481f24 Update urllib to 1.8.2 2014-04-24 14:43:26 -04:00
Kenneth Reitz
826425fdfd Merge pull request #2010 from Lukasa/philosophy
[WIP] Update philosophy section
2014-04-21 12:25:01 -04:00
Cory Benfield
6c1ddeedfb First pass at update to philosophy section. 2014-04-18 17:28:12 +01:00
Cory Benfield
082b877d81 We're awesome, but don't need to be here twice. 2014-04-18 17:15:45 +01:00
Cory Benfield
35d20b2168 Merge pull request #2009 from sigmavirus24/fix-my-name
Fix my name
2014-04-18 17:13:17 +01:00
Ian Cordasco
e56cc11757 Fix my name 2014-04-18 10:35:44 -05:00
Kenneth Reitz
229c4d8f7c Merge pull request #2005 from ap-Codkelden/master
SVG logo version
2014-04-16 15:37:29 -04:00
ap-Codkelden@github.com
b1d0f9743e SVG logo version (with fonts converted to curves) 2014-04-16 18:11:35 +03:00
Kenneth Reitz
b4354fc66f Revert "Font layer convert to curves"
This reverts commit af21ec6165.
2014-04-16 10:58:30 -04:00
Kenneth Reitz
b5fd95cab9 Merge pull request #1999 from ap-Codkelden/master
Font layer in logo convert to curves
2014-04-16 10:56:44 -04:00
Kenneth Reitz
df34ed7a00 @sigmavirus42 2014-04-15 19:15:39 -04:00
Kenneth Reitz
b8ba5c2bcb github urls 2014-04-15 19:11:58 -04:00
Kenneth Reitz
b2c801f3c7 Merge remote-tracking branch 'origin/master' 2014-04-15 19:07:52 -04:00
Kenneth Reitz
21010ee25a core contributors 2014-04-15 19:07:41 -04:00
Kenneth Reitz
f409d65d15 12,000,000 2014-04-15 19:01:41 -04:00
ap-Codkelden@github.com
af21ec6165 Font layer convert to curves 2014-04-12 21:13:52 +03:00
Cory Benfield
07ee20d07d Merge pull request #1998 from Kapishin/master
Fix typo
2014-04-10 06:46:05 +01:00
Pavlo Kapyshin
4ca4865170 Fix typo 2014-04-10 06:09:41 +03:00
Kenneth Reitz
338c5f6a0b Merge pull request #1991 from gutworth/patch-1
replace reference to crate.io
2014-04-08 10:19:39 -04:00
Cory Benfield
6f52970a6d Reinstate '$'. 2014-04-05 17:29:00 +01:00
Benjamin Peterson
fb2380c3cc delete pypi mirror section 2014-04-05 11:57:43 -04:00
Ionel Cristian Mărieș
96936b5616 Make it more clear where install commands are run (so that newbies don't run them in the REPL, I've seen it happen :). 2014-04-05 16:40:13 +03:00
Benjamin Peterson
8a23dd94cb replace reference to crate.io
crate.io is gone, so a different mirror should be used as an example. Also, the list of PyPI mirrors should be mentioned.
2014-04-04 23:58:18 -04:00
Cory Benfield
6a877661fb Merge pull request #1989 from sigmavirus24/HISTORY-updates
Make note of the fact that we fixed some CVEs
2014-04-03 06:51:07 +01:00
Ian Cordasco
b361a4c056 Make note of the fact that we fixed some CVEs 2014-04-02 19:04:58 -05:00
Kenneth Reitz
ae5ecdf2ae Merge pull request #1959 from Feng23/master
support request tuple data
2014-03-31 10:30:36 -04:00
Kenneth Reitz
826667a54c Merge pull request #1981 from stanhu/master
Update urllib to 1.8 (8a8c601bee)
2014-03-31 10:29:30 -04:00
Stan Hu
6c839985b9 Update urllib to 1.8 (8a8c601bee) 2014-03-28 16:37:54 -07:00
Feng Liu
24819e8aae support request tuple data
rewrite the TestModels

Ajust the code
2014-03-27 10:41:49 +08:00
Kenneth Reitz
0303e9b137 Merge pull request #1976 from kennethreitz/fix-redirect-test
The expected value changed for the proxies keyword
2014-03-26 11:34:36 -04:00
Ian Cordasco
b92f4ec6fb The expected value changes for the proxies keyword
It used to be None but a recent PR changed that before my last one was merged
2014-03-26 08:12:31 -05:00
Kenneth Reitz
b8128d6b1e Merge pull request #1962 from sigmavirus24/fix-history-type
Fix #1960: A Response's history should be a list
2014-03-24 11:45:06 -04:00
Kenneth Reitz
5f48e4a120 Merge pull request #1963 from sigmavirus24/fix-redirect-methods
Fix #1955: Do not use original request in redirect
2014-03-24 11:44:14 -04:00
Kenneth Reitz
a3cd2f3929 Merge remote-tracking branch 'origin/master' 2014-03-24 11:39:20 -04:00
Kenneth Reitz
b2db089eef 3.4 2014-03-24 11:39:15 -04:00
Avi Das
c2e6fe4d5d Shorten str for case insensitive dict 2014-03-23 11:38:37 -05:00
Kenneth Reitz
fe4c4f1461 Merge pull request #1951 from Lukasa/proxyauth
Re-evaluate proxy authorization.
2014-03-23 10:51:48 -04:00
Avi Das
a3fb689942 Fix parenthesis typo 2014-03-22 16:30:22 -05:00
Cory Benfield
90f7337858 Style changes thanks to @sigmavirus24. 2014-03-22 21:11:33 +00:00
Avi Das
98ac3df713 Add __str__ to case insensitive dict. Logging headers for debugging purposes is often necessary, and the currently logging the headers would be using __repr__ which would log the implementation detail of headers, caseinsensitivedict. Adding str lends a more printing and log friendly implementation for case insentitice dict 2014-03-22 15:42:23 -05:00
Ian Cordasco
8fc6a65be8 Actually assign history 2014-03-15 12:48:29 -05:00
Ian Cordasco
8d693a2a27 Fix #1955: Do not use original request in redirect
The original request was never being properly overriden in resolve_redirects.
As such being having a POST request respond with a 303 would generate a GET
request. If the GET request encountered another redirect to something like a
307, then it would use the original request and generate another POST request.

There are two parts to this fix:

- The fix itself
- The test infrastructure to ensure it does not regress because HTTPBin is
  insufficient
2014-03-15 11:38:13 -05:00
Ian Cordasco
daf56b3f62 Fix #1960: A Response's history should be a list 2014-03-15 10:33:00 -05:00
Cory Benfield
724038e4b5 Test stripping standard auth. 2014-03-12 21:53:07 +00:00
Cory Benfield
4f6dca42ea Remove some extraneous comments to please KR. 2014-03-12 21:21:14 +00:00
Kenneth Reitz
110048f983 Merge pull request #1916 from schlamar/accept-encoding
Fix Accept-Encoding in default headers
2014-03-12 16:37:27 -04:00
Kenneth Reitz
4112b8f14b Merge pull request #1949 from Lukasa/pickle
Pickled Responses should include a None value for the raw attribute
2014-03-12 16:18:58 -04:00
Cory Benfield
4d8cb3244e Add method for rebuilding proxy configuration.
This includes auth.
2014-03-12 19:22:40 +00:00
Cory Benfield
97cf16e958 Move auth rebuild to its own method. 2014-03-12 19:22:11 +00:00
Cory Benfield
6d7e8a97bb Split get_environ_proxies into two methods.
This makes it possible to get at the no_proxy logic separately.
2014-03-12 19:20:12 +00:00
Cory Benfield
ee7fe02953 Ensure that .raw() is present after unpickling.
Some people will assume that .raw() is present, and they shouldn't get
AttributeErrors when they make that assumption on a pickled Response.
However, @kennethreitz has asked that we not be too dependent on
urllib3. For that reason, set to None.
2014-03-12 18:34:43 +00:00
schlamar
a59fac5e4b Removed compress from accepted encodings. 2014-03-12 12:11:55 +01:00
Jason R. Coombs
7b378cb742 Add tests for decode_unicode 2014-03-04 17:46:58 -05:00
Jason R. Coombs
d289eb22f1 Always honor decode_unicode, even when _content is present.
--HG--
extra : amend_source : 25977a1227b163d49bf2e1aec6aa448e5cd3be8a
2014-03-04 16:33:40 -05:00
Jason R. Coombs
c8226f69e1 Add documentation about decode_unicode. 2014-03-04 16:27:13 -05:00
Cory Benfield
03f444e601 Timeout documentation changes. 2014-03-03 20:23:59 +00:00
Kenneth Reitz
d8557a2627 Merge pull request #1935 from cjstapleton/master
Add timeout to stream with testing
2014-03-03 13:14:37 -05:00
Kenneth Reitz
3c4b3747e4 Merge pull request #1921 from sigmavirus24/fix-session-header-none
Do not set headers with None value
2014-03-03 13:13:13 -05:00
Cory Benfield
9a14086e6d Merge pull request #1934 from kennethreitz/update-notice
Charade -> Chardet and Add cacert.pem license
2014-03-02 09:34:55 +00:00
Ian Cordasco
64f0b3c81e Remove unnecessary bits from cacert notice section 2014-03-01 11:15:14 -06:00
cjstapleton
5f404a0592 Fix styling issues with add timeout to stream with testing 2014-02-28 19:06:59 -06:00
cjstapleton
930f03c864 Add timeout to stream with testing
Fixes Issue #1803
2014-02-28 10:08:57 -06:00
Ian Cordasco
9b20cadaeb Charade -> Chardet and Add cacert.pem license
- Charade is gone, long live Chardet.
- cacert.pem is now taken wholesale from Mozilla so we need to display that
  itis licensed under the MPL2.0
2014-02-28 08:29:05 -06:00
schlamar
4404e7e328 Default proxy scheme to http. 2014-02-18 15:24:24 +01:00
schlamar
780ce3902e Revert "Proxy urls should have explicit schemes."
This reverts commit 840540b6b1.

Conflicts:
	requests/adapters.py
	requests/utils.py
2014-02-18 15:15:36 +01:00
Cory Benfield
e909a92343 Merge pull request #1923 from Lukasa/master
The timeout is in seconds.
2014-02-16 19:02:05 +00:00
Cory Benfield
81e88b70bd The timeout is in seconds. 2014-02-16 19:00:22 +00:00
Ian Cordasco
d2f647cee4 Do not set headers with None value
- Regardless of whether they are on the session or not
- Fixes #1920
2014-02-14 16:15:21 -06:00
Kenneth Reitz
3c88e520da Merge pull request #1918 from zackw/response-is-redirect
New Response property, .is_redirect.
2014-02-13 16:03:37 -05:00
Zack Weinberg
0caa243212 New Response property, .is_redirect. 2014-02-13 14:27:42 -05:00
Kenneth Reitz
4ecd74693f Merge pull request #1891 from sigmavirus24/add-requests-to-exceptions
Add request to RequestException
2014-02-11 11:58:23 -05:00
Kenneth Reitz
94badad24c Merge pull request #1897 from aliles/master
Document requirements for SNI support on Python2
2014-02-11 11:55:33 -05:00
Kenneth Reitz
1371e81944 Merge pull request #1900 from mjpieters/issue1674-json-fallback-encoding
Reinstate falling back to self.text for JSON responses
2014-02-11 11:55:20 -05:00
Cory Benfield
969195ad55 Clarify our 1.2.1 behaviour change. 2014-02-11 07:31:47 +00:00
Kenneth Reitz
a44910b837 Merge pull request #1902 from mjpieters/master
Remove unused loggers.
2014-02-06 18:32:41 -08:00
Cory Benfield
2b9b4a35b2 Merge pull request #1904 from mjpieters/doc-response-reason
Document the `Response.reason` attribute.
2014-02-05 18:32:16 +00:00
Martijn Pieters
3443c177a3 Document the Response.reason attribute.
Made `.status_code` and `.reason` consistent with one another, adding some examples. Addresses #1225.
2014-02-05 17:29:09 +00:00
Aaron Iles
98b76f4b98 State early in SNI discussion Python2 limitation
Reference at the earliest opportunity that Server-Name-Indication is a
limitation of Python 2.6 and 2.7. Avoid describing it as a Requests
issue.
2014-02-04 21:08:11 +11:00
Cory Benfield
15ac4e5fb6 Merge pull request #1901 from mjpieters/chardet-not-charade
One last Charade reference to remove here.
2014-02-04 00:53:53 -08:00
Martijn Pieters
488b90f5ac Remove unused loggers. 2014-02-03 13:43:59 +00:00
Martijn Pieters
c5b6a107eb One last Charade reference to remove here. 2014-02-03 13:39:21 +00:00
Martijn Pieters
f35838beb6 Remove logging and charade mention.
Logging is Not Allowed, so out it goes.
2014-02-03 13:37:57 +00:00
Martijn Pieters
5ee8b348eb Reinstate falling back to self.text for JSON responses
A JSON response that has no encoding specified will be decoded with a detected UTF codec (compliant with the JSON RFC), but if that fails, we guessed wrong and need to fall back to charade character detection (via `self.text`). Kenneth removed this functionality (by accident?) in 1451ba0c6d, this reinstates it again and adds a log warning.

Fixes #1674
2014-02-03 12:00:14 +00:00
Aaron Iles
8a0bae45c2 Move SNI documentation to FAQ
Relocate documentation on Server-Name-Indication from the advanced
section to the frequently asked questions. This is minus details on
enabling SNI on Python2, which is instead captured by linking to Stack
Overflow.
2014-02-02 22:19:10 +11:00
Aaron Iles
b5b8198fd1 Document requirements for SNI support on Python2
A section for Request's advanced usage guide on what Server Name
Indication is, its purpose, and how to enable it on Python2.
2014-02-02 20:14:05 +11:00
Kenneth Reitz
c6084704cc what is wrong with you people? :) 2014-01-31 12:31:11 -05:00
Kenneth Reitz
2b23d6a9f7 omg never do this again ever please 2014-01-31 12:30:52 -05:00
Kenneth Reitz
c042c08179 who did this 2014-01-31 12:29:56 -05:00
Kenneth Reitz
f74f5e3ebf cleanup shitty code 2014-01-31 12:27:05 -05:00
Kenneth Reitz
f1893c8355 Merge pull request #1892 from Lukasa/netrcauth
Repopulate ~/.netrc auth.
2014-01-31 09:19:53 -08:00
Cory Benfield
d9f34c6848 Respect trust_env on redirect. 2014-01-31 07:36:44 +00:00
Kenneth Reitz
4f12bfa636 Merge pull request #1893 from Lukasa/license
Avoid breaking crappy distribution methods.
2014-01-30 09:23:57 -08:00
Cory Benfield
326a22e888 Better layout for checking. 2014-01-30 15:11:24 +00:00
Cory Benfield
0163a836a1 Avoid breaking crappy distribution methods. 2014-01-29 19:21:04 +00:00
Cory Benfield
7ba5a534ae Repopulate ~/.netrc auth. 2014-01-29 19:13:46 +00:00
Ian Cordasco
07e0a6198d Explicitly check for None 2014-01-28 20:39:09 -06:00
Ian Cordasco
c2fab5b4ca Avoid having to fix tests 2014-01-28 20:24:41 -06:00
Ian Cordasco
27eb54a20a Move creation of attributes to RequestException
Pass request objects in HTTPAdapter
2014-01-28 20:13:57 -06:00
Kenneth Reitz
b1c8fd3b67 Merge pull request #1888 from longaccess/handle301
Fix for 301 redirect and latest PyOpenSSL.
2014-01-28 12:14:38 -08:00
Konstantinos Koukopoulos
8b792be81b on redirect pass URL as bytes. Fixes: #1887 2014-01-28 09:11:23 -08:00
Konstantinos Koukopoulos
b6e16799d0 test pyopenssl redirect (unit test for #1887) 2014-01-28 09:08:16 -08:00
Cory Benfield
19756d57f7 Merge pull request #1886 from meteozond/patch-1
Added info about posted files headers
2014-01-28 01:07:23 -08:00
Alexander
1e3eb4ef9e Added info about posted files headers 2014-01-28 12:03:59 +03:00
Ian Cordasco
42b8a6d8ab Merge pull request #1881 from kevinburke/typo
s/soley/solely
2014-01-25 05:38:39 -08:00
Kevin Burke
4c11fb7f04 s/soley/solely 2014-01-25 00:20:10 -08:00
Kenneth Reitz
06ecae43bd NOTICE update 2014-01-24 15:39:32 -05:00
Kenneth Reitz
7773b2712e Merge pull request #1870 from sigmavirus24/add-toolbelt-to-docs
Add a small note about requests-toolbelt
2014-01-23 10:54:08 -08:00
Kenneth Reitz
33735480f7 v2.2.1 2014-01-23 13:25:40 -05:00
Kenneth Reitz
a5b3719967 Merge pull request #1876 from dstufft/update-urllib3
Update urllib3 to 9346c5c
2014-01-23 10:22:21 -08:00
Donald Stufft
d181577f3e Update urllib3 to 9346c5c 2014-01-22 14:20:34 -05:00
Cory Benfield
2a6b835a5e Update changelog for 2.2.1. 2014-01-22 14:28:41 +00:00
Ian Cordasco
3bd16ce9c5 Add missing sled
Thanks @kevinburke
2014-01-21 19:55:00 -06:00
Cory Benfield
4872f4628c Merge pull request #1874 from kevinburke/typo
Typo in History
2014-01-21 10:24:37 -08:00
Kevin Burke
f17ead4133 Typo in History 2014-01-21 10:18:04 -08:00
Ian Cordasco
799bf116fe Add a small note about requests-toolbelt 2014-01-18 22:44:50 -06:00
Kenneth Reitz
c3055863c6 Update NOTICE 2014-01-16 15:12:40 -08:00
Kenneth Reitz
57c71ec9b6 Merge pull request #1867 from Lukasa/closing
Document contextlib.closing.
2014-01-16 14:16:04 -08:00
Cory Benfield
476ab203bc Document contextlib.closing. 2014-01-16 08:37:29 +00:00
Kenneth Reitz
0465d34955 Merge pull request #1862 from sybeck2k/master
Fixed parsing of username and password encoded in the URI
2014-01-14 11:56:04 -08:00
Roberto Migli
eb124353af Added comment for test test_get_auth_from_url 2014-01-13 16:29:46 +01:00
Roberto Migli
49fb630eb4 Merged changes from @lukasa 2014-01-13 14:04:28 +01:00
Roberto Migli
a6a8342066 Fixed parsing of username and password encoded in the URI 2014-01-13 13:32:00 +01:00
Ian Cordasco
87abd9c609 Use calendar.timegm when calculating cookie expiration
Fixes #1859

Credit: @lukasa
2014-01-12 14:27:45 -06:00
Cory Benfield
5b4e9aff0e Don't need to unquote twice. 2014-01-12 14:46:40 +00:00
Cory Benfield
2f98ef1792 Be less defensive in get_auth_from_url. 2014-01-12 14:44:53 +00:00
Cory Benfield
b4ca6c95b6 Meet @sigmavirus24's demanding stylistic criteria. 2014-01-12 09:39:32 +00:00
Cory Benfield
dddb41e349 TypeError, not AttributeError on 3.3. 2014-01-11 10:15:53 +00:00
Cory Benfield
ca187abd13 Unquote the auth after splitting the url. 2014-01-11 09:59:23 +00:00
Cory Benfield
ac4e05874a Fixup the header heirarchy. 2014-01-09 19:50:56 +00:00
Cory Benfield
098865122c Merge branch 'master' of github.com:dsoprea/requests
Conflicts:
	docs/user/advanced.rst
2014-01-09 19:46:32 +00:00
Kenneth Reitz
1720e4bb87 fix rst syntax bugs 2014-01-09 14:38:44 -05:00
Kenneth Reitz
0db1d3d675 v2.2.0 2014-01-09 14:33:17 -05:00
Kenneth Reitz
94981e1701 Merge pull request #1854 from Lukasa/220
Changelog for 2.2.0.
2014-01-09 11:14:45 -08:00
Cory Benfield
48e2ecc14d Changelog for 2.2.0. 2014-01-09 19:10:30 +00:00
Cory Benfield
4862d29a96 Make ContentDecodingError a subclass.
This should avoid the user having to worry about the new exception.
2014-01-09 19:08:58 +00:00
Dustin Oprea
3ccdfce2e5 Added an SSL TA example. 2014-01-09 11:41:30 -05:00
Kenneth Reitz
14f207f3fc Merge pull request #1846 from acdha/paranoid-get_netrc_auth
get_netrc_auth should handle os.path.expanduser failing
2014-01-08 10:57:09 -08:00
Kenneth Reitz
df1c2335c8 Merge branch 'master' into fix-pickling-adapters
Conflicts:
	AUTHORS.rst
2014-01-08 13:53:23 -05:00
Kenneth Reitz
b17cad65cf Merge pull request #1845 from Lukasa/proxy_bypass
Resolve proxy_bypass problems.
2014-01-08 10:51:08 -08:00
Kenneth Reitz
a855ba8189 Merge pull request #1827 from pepijndevos/master
Use adapter pool size for proxies
2014-01-08 10:50:00 -08:00
Kenneth Reitz
632304209c Merge pull request #1831 from kevinburke/interlinks
Add more interlinks between the documentation
2014-01-08 10:48:25 -08:00
Kenneth Reitz
e93b07eef6 Merge pull request #1832 from kevinburke/docs-warnings
Fix warnings when building the docs
2014-01-08 10:45:33 -08:00
Kenneth Reitz
73c3040896 Merge pull request #1836 from sigmavirus24/2014
Bump the year ftw
2014-01-08 10:44:20 -08:00
Kenneth Reitz
0f40d8149a Merge pull request #1849 from kevinburke/urllib3-update
Update urllib3 to 232f496
2014-01-07 15:22:24 -08:00
Kevin Burke
e1562afb58 Update urllib3 to 232f496 2014-01-07 12:32:01 -08:00
Chris Adams
a80bd7708d get_netrc_auth: code cleanup
* Stop iterating as soon as we find a netrc file
* More obvious return None
2014-01-07 12:23:11 -05:00
Kenneth Reitz
e40342afbe /me grumbles 2014-01-07 12:03:24 -05:00
Chris Adams
0b41cec7a4 get_netrc_auth: handle os.path.expanduser failure
os.path.expanduser can raise a KeyError when $HOME is not set and the
POSIX getpwuid() call fails, which can happen when running under a UID
which is not in /etc/passwd or when the password file cannot be read.

The upstream bug report http://bugs.python.org/issue20164 is unlikely to
be backported to Python 2.x even if fixed so this change handles
KeyError by skipping netrc authentication.

Closes #1846
2014-01-07 11:34:51 -05:00
Cory Benfield
e2a36dda0a Don't let proxy_bypass bring you down. 2014-01-07 09:37:59 +00:00
Ian Cordasco
14a1839a45 No one checks docs or a license 2014-01-02 16:05:29 -06:00
Ian Cordasco
81f4412e0e Bump the year ftw 2014-01-02 16:01:15 -06:00
Kevin Burke
a0e7706440 Fix warnings when building the docs
It may be nice to make builds fail if new documentation generates warnings, to
avoid these sorts of problems slipping in in the future.
2013-12-28 00:09:29 -08:00
Kevin Burke
fad8d743b5 Add more interlinks between the documentation
Also fixes up tense in a few cases, and adds the `intersphinx` extension so we
can link to the urllib3 documentation when it is called out.
2013-12-27 23:43:55 -08:00
Pepijn de Vos
9e843468de use adapter pool size for proxies 2013-12-24 11:14:04 +01:00
Kenneth Reitz
99ebac7e84 Merge pull request #1823 from Lukasa/moredocs
Update docs to highlight the value of r.encoding.
2013-12-20 06:21:04 -08:00
Cory Benfield
4a6a0c3c65 Update docs to highlight the value of r.encoding. 2013-12-20 09:15:12 +00:00
Kenneth Reitz
e0ba49e780 Merge pull request #1807 from podshumok/fix-request-cookiejar-as-dict
cookiejar.iteritems() is broken after 2.1.0 update
2013-12-19 12:38:52 -08:00
Kenneth Reitz
11cd49987a Merge pull request #1816 from daftshady/master
Re-raise DecodeError
2013-12-19 12:38:34 -08:00
daftshady
aad828704d Re-raise DecodeError 2013-12-19 18:02:56 +09:00
Kenneth Reitz
0eb6dc36f0 Merge pull request #1808 from kennethreitz/fix-cookies-saved-on-redirect
Fixes #1805
2013-12-18 07:56:30 -08:00
Kenneth Reitz
d88cd02fd8 Merge pull request #1810 from kennethreitz/swap-charade-for-chardet
Swap charade for chardet
2013-12-18 07:52:55 -08:00
Konstantin Podshumok
b8f1263f16 split cookiejar as dict test 2013-12-18 18:50:53 +04:00
Ian Cordasco
d8d9591076 Update the history and change the last last references to charade 2013-12-18 08:46:49 -06:00
Ian Cordasco
9379a14cb4 Fix all remaining references to charade 2013-12-18 08:43:18 -06:00
Ian Cordasco
0bfbacd8b1 Initial work towards replacing charade 2013-12-18 08:42:12 -06:00
Konstantin Podshumok
e6a32d6283 preserve python2-like dict API for RequestCookieJar 2013-12-18 18:09:24 +04:00
Ian Cordasco
642bbf6060 Fixes #1805
Sure cookies are persisted to the session, but those new cookies are not added
to the next prepared request. We need to update that new request's CookieJar
with the new cookies.
2013-12-17 22:55:50 -06:00
Konstantin Podshumok
537def4a4f fix regression with cookiejar.iteritems() 2013-12-18 06:56:53 +04:00
Kenneth Reitz
1832e33753 Merge remote-tracking branch 'origin/master' 2013-12-16 13:19:36 -05:00
Kenneth Reitz
39d12818fe 8,000,000 2013-12-16 13:19:30 -05:00
Ian Cordasco
1500632b60 Move comment to the right place 2013-12-13 22:29:30 -06:00
Erik Wickstrom
d3f3b423ad Updated AUTHORS. 2013-12-13 22:28:46 -06:00
Erik Wickstrom
16f9798208 Fixed pickle support for requests.adapters.HTTPAdapter by adding
'proxy_manager' when unpickling.
2013-12-13 22:28:37 -06:00
Ian Cordasco
cac2077c36 Prevent error when using proxies after picking an Adapter 2013-12-12 13:03:37 -06:00
Cory Benfield
0b680379e5 Merge pull request #1792 from Lukasa/oops
Fixup changelog with missing breaking change.
2013-12-12 08:21:38 -08:00
Cory Benfield
456c42b00d Fixup changelog with missing breaking change. 2013-12-12 16:21:04 +00:00
Kenneth Reitz
9fc0701247 Merge pull request #1772 from mdbecker/make_morsel_to_cookie_more_pythonic
Make morsel_to_cookie more pythonic
2013-12-06 07:38:12 -08:00
Michael Becker
837ba94dde test_requests: convert tests to py.test style 2013-12-06 10:08:42 -05:00
Michael Becker
ea4570da57 cookies: Fix bugs found during CI 2013-12-06 09:02:45 -05:00
Michael Becker
ef5875cc19 cookies: Take a less cowardly approach
Per discussion with @sigmavirus24, we'll take the less cowardly approach here.
"the RFC defines the Expires header as a string with the format we're assigning to ``time_template`` so checking if it is a string is unnecessary."

Crossing my fingers that this doesn't break anyones existing code...
2013-12-06 09:02:45 -05:00
Michael Becker
6ac70450dc AUTHORS: Take credit 2013-12-06 08:57:37 -05:00
Michael Becker
6140d08241 cookies: Replace type checks with try/except 2013-12-06 08:56:30 -05:00
Michael Becker
39841562c5 test_requests: Add tests for morsel_to_cookie
These tests will ensure my changes to how we handle 'expires' don't cause any regressions.
2013-12-06 08:56:30 -05:00
Kenneth Reitz
3235766d67 updated CA Bundle! 2013-12-05 17:51:10 -05:00
Kenneth Reitz
57c4684035 Merge remote-tracking branch 'origin/master' 2013-12-05 17:45:05 -05:00
Kenneth Reitz
795f18560b last changelog entry 2013-12-05 17:44:56 -05:00
Kenneth Reitz
aae7e39a56 further notes and version bump 2013-12-05 17:41:25 -05:00
Kenneth Reitz
ba3dab5047 Merge pull request #1770 from kmadac/master
Implemetation of IP address ranges for no_proxy environment variable
2013-12-05 14:40:44 -08:00
Kenneth Reitz
f6107bc151 history notes about v2.1 2013-12-05 17:37:48 -05:00
Kenneth Reitz
1cac72bfa9 Merge pull request #1669 from Lukasa/chunked
[WIP] Better chunked handling.
2013-12-05 14:36:10 -08:00
Kenneth Reitz
2dae61c0e3 Merge pull request #1776 from sigmavirus24/fix-1728
Fix 1728 (Fixed up from #1729)
2013-12-05 14:26:58 -08:00
Kenneth Reitz
e851efb29b Merge pull request #1781 from Lukasa/ucliteral
Clean up #1779.
2013-12-05 14:00:58 -08:00
Cory Benfield
57c138e59b Remove the unicode literals. 2013-12-05 21:06:11 +00:00
Kenneth Reitz
2c465de332 Merge pull request #1779 from kracekumar/patch-2
Made default_user_agent reusable
2013-12-05 11:44:06 -08:00
Kamil Madac
1d42d9d274 function is_ipv4_network renamed
more detailed check of cidr format
2013-12-05 11:15:52 +01:00
Kamil Madac
f3bc8b6e1f Typo fixed 2013-12-05 09:36:49 +01:00
Kamil Madac
21c88c829a Broad exception fixed 2013-12-05 09:32:29 +01:00
kracekumar
6c1be607f1 Made default_user_agent reusable
This is not exciting change, but will help for people who wants to change name of user agent alone. Also name can be unicode.
2013-12-05 12:11:35 +05:30
Kamil Madac
59b29d02f8 Tiny comment fix 2013-12-04 15:11:10 +01:00
Kamil Madac
0d52ef7084 Additional tests added 2013-12-04 15:10:24 +01:00
Ian Cordasco
e8bdcdb0a7 Address feedback from #1729
- Make the PreparedRequest's cookie jar an implementation detail
2013-12-04 06:45:18 -06:00
Chase Sterling
8bfe0d873f Store the request cookiejar in PreparedRequest.cookies fix #1728
Conflicts:
	requests/sessions.py
2013-12-04 06:38:58 -06:00
Chase Sterling
5b30e960eb Add a test case for request cookies persisting to session. refs #1728 2013-12-04 06:35:16 -06:00
Kamil Madac
947248129b Better comments 2013-12-04 11:47:40 +01:00
Kamil Madac
0a4e65c0ed Tests added 2013-12-04 10:54:36 +01:00
Kamil Madac
fe945345dd Unnecessary files kmadac.xml deleted 2013-12-04 09:31:56 +01:00
Kamil Madac
dfd3e45ad0 Merge branch 'master' of https://github.com/kmadac/requests 2013-12-04 09:30:01 +01:00
Kenneth Reitz
4bceb312f1 Merge pull request #1768 from Lukasa/credpct
Unencode usernames and passwords taken from URLs.
2013-12-03 17:36:00 -08:00
Kenneth Reitz
b2cee7bee8 Merge pull request #1764 from Lukasa/clog
Prepare new release (2.1.0)?
2013-12-03 17:35:02 -08:00
Kenneth Reitz
a030a58303 Merge pull request #1766 from Lukasa/qop
Quote qop values in digest auth.
2013-12-03 17:33:59 -08:00
Kenneth Reitz
5c915451e7 Merge pull request #1657 from sigmavirus24/fix-session-hooks
Honor session hooks
2013-12-03 17:33:42 -08:00
Kenneth Reitz
8b88549bb7 Merge pull request #1713 from daftshady/master
Fixed #1711
2013-12-03 17:33:33 -08:00
Kenneth Reitz
3e66f08db7 Merge pull request #1775 from sigmavirus24/add-readme-to-packages
Add README to requests/packages
2013-12-03 17:02:25 -08:00
Kamil Madac
6131390345 Revert "Small test added"
This reverts commit f0d3edf409.
2013-12-03 16:41:07 +01:00
Kamil Madac
0eccd7a856 Merge remote-tracking branch 'origin/master'
Conflicts:
	test_requests.py
2013-12-03 16:34:02 +01:00
Kamil Madac
f0d3edf409 Small test added 2013-12-03 16:30:47 +01:00
Kamil Madac
8aff6f5ed0 Redesigned no_proxy ip range imlementation to use only stdlib functions 2013-12-03 16:23:08 +01:00
Ian Cordasco
617bc8cc1c Add README to requests/packages
- Hopefully people will read this before making changes to vendored libraries
2013-12-03 09:17:37 -06:00
Kamil Madac
f9a48e0f0b Added kamil.madac to Authors 2013-12-02 22:42:20 +01:00
Kamil Madac
9ec222c363 Added test for domain name no_proxy matching. 2013-12-02 22:40:26 +01:00
Kamil Madac
2c914126ba Added possibility to use IP ranges (ex. 192.168.1.0/24) to no_proxy environment variable 2013-12-02 22:32:29 +01:00
Cory Benfield
e2961b9f91 Unquote the URL before extracting the auth. 2013-12-01 10:29:14 +00:00
Cory Benfield
4f786e4f62 Tests for #1767. 2013-12-01 10:29:10 +00:00
Cory Benfield
92d3616b02 Merge remote-tracking branch 'upstream/pr/1765' into qop 2013-11-29 16:44:13 +00:00
Cory Benfield
fecb35a08e Quote qop values in digest auth. 2013-11-29 08:37:25 +00:00
佐藤 建太
649dac1029 quote qop options in Digest Auth
Based on RFC2617 (http://tools.ietf.org/html/rfc2617), the value of
'qop-options' directive should be quoted with double quotes:

    qop-options
         This directive is optional, but is made so only for backward
         compatibility with RFC 2069 [6]; it SHOULD be used by all
         implementations compliant with this version of the Digest
         scheme. If present, it is a quoted string of one or more
         tokens indicating the "quality of protection" values supported by
         the server.  The value "auth" indicates authentication; the
         value "auth-int" indicates authentication with
         integrity protection; see the

curl comamnd-line tool also appends these quotes. You can see this
by `curl -v --digest --user user:passwd http://example.com/digest-auth`.
Unfortunately, some minor server-side implementations seem to be sensitive
on this difference.
2013-11-29 15:28:47 +09:00
Cory Benfield
dc31c11339 Missed a couple. 2013-11-28 18:37:45 +00:00
Cory Benfield
e45d425343 Prepare changelog. 2013-11-28 18:32:28 +00:00
Kenneth Reitz
847735553a Merge pull request #1762 from dstufft/update-urllib3
Update urllib3 to 929f1586
2013-11-27 09:23:40 -08:00
Donald Stufft
b825bbd4a2 Update urllib3 to 929f1586 2013-11-26 21:41:15 -05:00
daftshady
c26a6c310c remove unused import 2013-11-26 15:38:48 +09:00
daftshady
8eb40c777e remove unnecessary try 2013-11-26 15:28:59 +09:00
daftshady
8b2255d0f8 double try statement 2013-11-26 15:28:59 +09:00
daftshady
5fcaf45c33 update 'merge_cookies' not to create new instance. 2013-11-26 15:28:59 +09:00
daftshady
1adba3c9e9 modified 'merge_cookies' and update tests.
made sessions.py to use that method when merging cookies.
2013-11-26 15:28:59 +09:00
daftshady
30018e604c update 'merge_cookies' 2013-11-26 15:28:59 +09:00
daftshady
e40c1637c9 added new method 'merge_cookies' and use it when merging session cookies with param cookies. 2013-11-26 15:28:59 +09:00
daftshady
e3c771f36b added test case related to #1711 2013-11-26 15:22:46 +09:00
daftshady
2bbd7ba1c2 Fixed #1711 2013-11-26 15:22:46 +09:00
Kenneth Reitz
340b245903 Merge pull request #1760 from akitada/fix-hangs-on-streaming-uploads
Fix hangs on streaming uploads with HTTPDigestAuth
2013-11-25 11:40:10 -08:00
Kenneth Reitz
e5b9ae1f8e Merge pull request #1754 from Lukasa/verb_change
Match the HTTPbis on HTTP 301.
2013-11-25 11:40:00 -08:00
Akira Kitada
3a9d9f2279 Fix hangs on streaming uploads with HTTPDigestAuth
When using Digest Authentication, the client resends the same request
after the server responds with the 401 "Unauthorized". However, when
doing streaming uploads, it gets stuck because the body data (a
file-like object) is already consumed at the initial request.

The patch fixes this by rewinding the file-like object before
resending the request.
2013-11-25 22:29:53 +09:00
Cory Benfield
3369d87da9 Cleanup the redirect if blocks. 2013-11-24 11:13:49 +00:00
Cory Benfield
470af31f4a Handle 301s 'properly'. 2013-11-24 11:09:00 +00:00
Kenneth Reitz
3327652623 Merge pull request #1747 from daftshady/lowercase
#1746 don't lowercase the whole url
2013-11-20 01:05:15 -08:00
Kenneth Reitz
8a4c83022a Merge pull request #1742 from kevinburke/docs
Add make target to build the documentation
2013-11-20 01:02:38 -08:00
Kenneth Reitz
af921c7f51 Merge pull request #1733 from ionrock/pickleable-responses
Response and Request objects are pickleable.
2013-11-20 01:01:26 -08:00
Kenneth Reitz
248c9ec53f Merge pull request #1745 from nonm/master
Small fix broken cookie parse
2013-11-20 00:58:21 -08:00
daftshady
4972133a9b use geturl to lower scheme 2013-11-19 19:54:46 +09:00
daftshady
8c8938e8cb issue #1746 : Don't lowercase the whole URL! 2013-11-19 18:59:22 +09:00
nonm
cfbbd15de7 Small fix broken cookie parse 2013-11-18 13:32:59 -08:00
Kevin Burke
0c88ae42e6 wording 2013-11-17 18:39:01 -08:00
Kevin Burke
4b69798796 Add target to build the documentation 2013-11-17 18:38:15 -08:00
Kenneth Reitz
947375e982 Merge pull request #1739 from pengfei-xue/devel
add coverage make target
2013-11-15 10:51:47 -08:00
Pengfei Xue
afaed3343a add coverage make target 2013-11-15 22:11:49 +08:00
Kenneth Reitz
42bffb575d Merge pull request #1735 from Lukasa/wheel
Wheel
2013-11-15 01:33:38 -08:00
Kenneth Reitz
bcb10af64f Merge pull request #1717 from jvantuyl/master
loosen URL handling for non-native URL schemes
2013-11-15 01:33:03 -08:00
Jayson Vantuyl
b149be5d86 loosen URL handling for non-native URL schemes 2013-11-15 01:25:32 -08:00
Cory Benfield
abf96670ce Add wheel to dev requirements. 2013-11-14 13:23:45 +00:00
Cory Benfield
86bdd85c4a Wheel support. 2013-11-13 19:09:49 +00:00
Eric Larson
512beb8795 Response and Request objects are pickleable.
Includes a basic test. More could be add to confirm known attributes
that could cause problems.
2013-11-06 20:01:27 -06:00
Kenneth Reitz
a123f8351d Merge pull request #1660 from sigmavirus24/parse-cookies-when-users-set-host-header
Parse cookies when users set custom Host header
2013-11-06 11:19:31 -08:00
Kenneth Reitz
7ccbcd28f0 Merge pull request #1724 from daftshady/dev3
Fixed #1723
2013-11-04 13:58:12 -08:00
Kenneth Reitz
598f977df4 Merge pull request #1726 from t-8ch/update_urllib3
Update urllib3
2013-11-04 13:55:58 -08:00
Thomas Weißschuh
c477242376 add myself to AUTHORS.rst 2013-11-04 18:54:42 +00:00
Thomas Weißschuh
3ef4115349 upate urllib3 to a0c986a24d 2013-11-04 18:53:41 +00:00
daftshady
1511dfa637 moved logic to Session object and added test case 2013-11-04 22:32:17 +09:00
daftshady
495f87363b fixed #1723 2013-11-04 18:33:14 +09:00
Ian Cordasco
1ba83c47ce Merge pull request #1722 from schinckel/patch-1
Fix documentation typo.
2013-11-03 18:16:21 -08:00
Matthew Schinckel
edf7e5f420 Fix documentation typo. 2013-11-04 12:29:24 +10:30
Cory Benfield
9ffcbb82a2 Capitalisation. 2013-11-01 11:14:05 +00:00
Cory Benfield
c86de38780 Merge pull request #1720 from Lukasa/docs
Chardet -> charade.
2013-11-01 02:21:01 -07:00
Cory Benfield
20f8027641 Chardet -> charade. 2013-11-01 09:20:22 +00:00
Kenneth Reitz
0228851f19 Revert "Merge pull request #1710 from jvantuyl/master"
This reverts commit a8300c0ae6, reversing
changes made to 2e196be143.
2013-10-30 15:32:19 -04:00
Kenneth Reitz
a8300c0ae6 Merge pull request #1710 from jvantuyl/master
loosen URL handling for non-native protocols
2013-10-30 10:17:26 -07:00
Jayson Vantuyl
a9ec28a1b4 don't prepare URLs for oddball schemes 2013-10-30 10:04:43 -07:00
Kenneth Reitz
2e196be143 Merge pull request #1709 from samuelhug/test-branch
Fix for AppEngine
2013-10-28 10:40:52 -07:00
Kenneth Reitz
ebdd5cabab further cleanup examples 2013-10-28 13:39:04 -04:00
Kenneth Reitz
a9839dc7db Merge remote-tracking branch 'origin/master' 2013-10-28 13:36:08 -04:00
Kenneth Reitz
2c1f51be0e fix @lukasa's lack of taste :)
#1702
2013-10-28 13:36:04 -04:00
Kenneth Reitz
129ee3510f Merge pull request #1702 from Lukasa/docs_n_stuff
Improve the PreparedRequest docs.
2013-10-28 10:34:07 -07:00
Kenneth Reitz
55ad38964b Merge pull request #1706 from daftshady/dev2
restoring pull request fixing #1623
2013-10-28 10:32:21 -07:00
Kenneth Reitz
2d5542502b Merge pull request #1707 from canibanoglu/tests
Modified the tests so that they use py.test convention
2013-10-28 10:32:09 -07:00
Kenneth Reitz
c4a7760ca6 Merge pull request #1708 from alex/patch-2
close files in setup.py
2013-10-28 10:31:59 -07:00
Samuel Hug
a501b0ca81 Fix for AppEngine 2013-10-28 09:51:56 -07:00
Alex Gaynor
3488f3ade7 close files in setup.py
otherwise python3.4 warns
2013-10-26 16:43:08 -07:00
Can Ibanoglu
aa60b8ea5b Modified the tests so that they use py.test convention 2013-10-26 13:38:11 +03:00
daftshady
6931bd6715 second commit : Fixed #1623. Added 'MD5-sess' algorithm to HTTPDigestAuth 2013-10-26 18:14:19 +09:00
Kenneth Reitz
25f86f1347 clean up sidebar 2013-10-24 18:09:12 -04:00
Kenneth Reitz
1f83ccb308 get support 2013-10-24 18:07:47 -04:00
Kenneth Reitz
592fb34a3d try gumroad overlay 2013-10-24 18:05:24 -04:00
Kenneth Reitz
cb0d4efba2 projects 2013-10-24 18:01:50 -04:00
Kenneth Reitz
3d8d465a90 "get updates" 2013-10-24 18:00:52 -04:00
Kenneth Reitz
ded42e6498 newsletter 2013-10-24 17:58:30 -04:00
Cory Benfield
e8683f00a6 Improve the PreparedRequest docs. 2013-10-24 21:14:46 +01:00
Kenneth Reitz
7b5c11f66b Merge remote-tracking branch 'origin/master' 2013-10-24 10:54:48 -04:00
Kenneth Reitz
afa7594a20 build status isn't useful anyway 2013-10-24 10:54:45 -04:00
Kenneth Reitz
6e52b5fe41 Merge pull request #1689 from Lukasa/unicode
Use builtin_str for all auto-set header values.
2013-10-24 07:38:52 -07:00
Kenneth Reitz
52fe3f790e Merge pull request #1693 from kevinburke/schema-message
Add clarification to MissingSchema error
2013-10-24 07:35:40 -07:00
Kenneth Reitz
dd777b3d7e urllib3/chardet note in release for v2.0.1 2013-10-24 10:32:05 -04:00
Kenneth Reitz
df272b7740 update internal dependencies 2013-10-24 10:31:05 -04:00
Kenneth Reitz
db108a19c8 Merge pull request #1700 from kennethreitz/v2.0.1
v2.0.1
2013-10-24 07:29:11 -07:00
Kenneth Reitz
c244f8ea87 more release notes for v2.0.1 2013-10-24 10:28:30 -04:00
Kenneth Reitz
f045979f8d release notes 2013-10-24 10:26:47 -04:00
Kenneth Reitz
3d59569264 v2.0.1 2013-10-24 10:00:49 -04:00
Kenneth Reitz
5469291296 $ make ci 2013-10-24 09:54:14 -04:00
Kenneth Reitz
3b35f1c37d replace invoke with makefiles 2013-10-24 09:53:00 -04:00
Kenneth Reitz
e813574497 remove travis support 2013-10-24 09:47:31 -04:00
Kenneth Reitz
e1e6255b48 Merge pull request #1699 from kennethreitz/cert-update
Latest Mozilla Certs
2013-10-24 06:44:26 -07:00
Kenneth Reitz
1a9f0be6df Latest Mozilla Certs
generated via https://github.com/tiran/extract-nss-root-certs
2013-10-24 09:40:39 -04:00
Kenneth Reitz
d9ec7000db Merge pull request #1696 from canibanoglu/remove-parentheses
Removed extra extra parentheses in SessionRedirectMixin.resolve_redirects
2013-10-24 04:10:14 -07:00
Cory Benfield
6b975cbd82 Merge pull request #1697 from canibanoglu/docstring-PreparedRequest
Deleted the extra word in PreparedRequest.prepare's docstring
2013-10-22 14:19:47 -07:00
Can Ibanoglu
76be17b00a Deleted the extra word in PreparedRequest.prepare's docstring 2013-10-23 00:15:41 +03:00
Can Ibanoglu
0cd6959f19 Removed extra extra parentheses in SessionRedirectMixin.resolve_redirects 2013-10-22 23:48:04 +03:00
Cory Benfield
741fd3ded5 Remove requests.*() from docs.
This looks like a typo, even though it isn't.
2013-10-21 11:57:06 +01:00
Cory Benfield
ff2b496e2d Merge pull request #1695 from sigmavirus24/docs
Add bit to docs about iter_content
2013-10-21 01:31:50 -07:00
Ian Cordasco
6a24eb6d20 Add bit to docs about iter_content 2013-10-20 12:29:43 -05:00
Kevin Burke
b5d2160ef8 use .format() 2013-10-20 10:17:54 -07:00
Kevin Burke
333ac101ba Add clarification to MissingSchema error 2013-10-20 00:46:41 -07:00
Cory Benfield
8a42d5fb41 Use builtin_str for all auto-set header values. 2013-10-18 18:34:29 +01:00
Kenneth Reitz
e91ee0e246 Merge remote-tracking branch 'origin/master' 2013-10-17 02:33:05 -04:00
Kenneth Reitz
ab8e43a196 fix unprotected build status link 2013-10-17 02:32:16 -04:00
Kenneth Reitz
c05b1bfca9 Update README.rst 2013-10-17 01:51:50 -04:00
Kenneth Reitz
011f6dac82 Merge remote-tracking branch 'origin/master' 2013-10-17 01:47:39 -04:00
Kenneth Reitz
f35363e584 test out requests-trunk badge 2013-10-17 01:47:00 -04:00
Cory Benfield
c8d3dcb315 Small grammar fix. 2013-10-16 22:11:54 +01:00
Cory Benfield
2ec1bdd0ab Merge pull request #1675 from houqp/master
fix doc for redirction and history
2013-10-16 14:10:31 -07:00
Qingping Hou
3d0a1eb90d fix doc for redirction and history
In current version of requests, allow_redirect is disabled by default
only for HEAD requests
2013-10-16 16:59:22 -04:00
Kenneth Reitz
65ec319f01 Merge pull request #1673 from daftshady/dev
fixed typo
2013-10-15 02:47:55 -07:00
daftshady
17dd3c0a76 fixed typo 2013-10-15 18:33:51 +09:00
Cory Benfield
9606f0240b PEP8 fix to make me happier. 2013-10-13 09:54:01 +01:00
Cory Benfield
31c0962e83 Better connection behaviour for chunked upload. 2013-10-13 09:53:44 +01:00
Kenneth Reitz
3f84190a7b Merge pull request #1667 from Lukasa/json2
Second time lucky for json related fixes.
2013-10-12 14:15:30 -07:00
Cory Benfield
bea2060182 'or content' does us no good. 2013-10-12 21:05:34 +01:00
Ian Cordasco
6632fb87c0 Fix typo 2013-10-11 20:42:52 -05:00
Ian Cordasco
df7aece2c8 Comment our reasonsing for the special cases 2013-10-10 20:43:18 -05:00
Kenneth Reitz
097121d214 Merge pull request #1662 from voberoi/patch-1
Adding myself to AUTHORS.rst
2013-10-10 15:45:14 -07:00
Vikram Oberoi
21c9680a11 Adding myself to AUTHORS.rst
Taking a page out of @mattspitz's book.

https://github.com/kennethreitz/requests/pull/1439

#dreamsdocometrue
2013-10-10 18:13:51 -04:00
Kenneth Reitz
8d63577b78 Merge pull request #1661 from mattspitz/super_len_compatibility
Increasing super_len compatibilty to include BytesIO and cStringIO objects.
2013-10-10 12:11:14 -07:00
Matt Spitz
2c2af651c4 Adding myself to AUTHORS.rst. 2013-10-10 15:08:34 -04:00
Matt Spitz
13a6e02ccd Increasing super_len compatibilty to include BytesIO and cStringIO objects.
Added a check for 'getvalue' attr, calling it to retrieve the length if we can.

We also try/except the fileno() call, which can throw
io.UnsupportedOperation for BytesIO because, well, they're not files.
2013-10-10 14:54:47 -04:00
Cory Benfield
025543b604 Merge pull request #1658 from randymorris/master
False -> True typo
2013-10-08 11:36:12 -07:00
Randy Morris
f32b86dba2 False -> True typo 2013-10-08 14:19:30 -04:00
Ian Cordasco
0bb8be0e5b Parse cookies when users set custom Host header 2013-10-07 21:43:21 -05:00
Ian Cordasco
a4605fe324 Fix failing test to preserve behaviour 2013-10-07 21:17:59 -05:00
Ian Cordasco
f12584b94a Add tests around hook behaviour 2013-10-07 21:17:46 -05:00
Kenneth Reitz
43477edc91 Merge pull request #1636 from Lukasa/httpsprox
Don't send the full URL on CONNECT messages.
2013-10-07 16:23:18 -07:00
Kenneth Reitz
318ca102cd Merge pull request #1635 from daftshady/dev
Fixed #1630 and added test case.
2013-10-07 16:22:49 -07:00
Kenneth Reitz
14c12fb151 Merge pull request #1637 from Lukasa/redir
Correctly lowercase a redirect scheme.
2013-10-07 16:21:29 -07:00
Kenneth Reitz
3246fc088a Merge pull request #1640 from abarnert/master
Accept per-file headers in multipart file POST messages.
2013-10-07 16:21:16 -07:00
Cory Benfield
45873e2a0a Merge pull request #1656 from randymorris/master
Update verbiage about streaming requests
2013-10-07 13:45:11 -07:00
Ian Cordasco
5bf396d5d1 Honor session hooks 2013-10-07 12:23:16 -05:00
Randy Morris
66339b21fa update verbiage about streaming requests
The Twitter API is no longer used in the example.
2013-10-07 10:43:48 -04:00
Cory Benfield
d8180f5dac Merge pull request #1654 from riyadparvez/deprecation-removal
Deprecation removal and other idiomatic updates
2013-10-05 10:02:46 -07:00
Riyad Parvez
48f59aa1f7 back to BaseException 2013-10-05 22:49:54 +06:00
Riyad Parvez
56c82c52b0 fixed print statement 2013-10-05 20:12:18 +06:00
Riyad Parvez
36485983ca fixed print statement 2013-10-05 20:11:30 +06:00
Riyad Parvez
6087015f1c Update advanced.rst 2013-10-05 20:10:27 +06:00
Riyad Parvez
5c92c72e2c removed deprecated while 1: 2013-10-05 09:59:47 +06:00
Riyad Parvez
4656c9b89b fixed print statement 2013-10-05 09:57:18 +06:00
Riyad Parvez
8370e66464 fixed print statement 2013-10-05 09:56:11 +06:00
Riyad Parvez
f9b7d92b91 updated print statement 2013-10-05 09:55:14 +06:00
Riyad Parvez
c8a68334a7 replaced deprecated BaseException 2013-10-05 09:53:34 +06:00
Cory Benfield
953b234aff Merge pull request #1649 from dpursehouse/minor-doc-updates
Minor doc updates
2013-10-04 01:55:19 -07:00
Kenneth Reitz
c9bee155c2 Merge pull request #1651 from GrahamDumpleton/master
Translate urllib3 ProxyError into a requests ProxyError derived from ConnectionError.
2013-10-03 23:14:26 -07:00
Graham Dumpleton
4291f76c99 Translate urllib3 ProxyError into a requests ProxyError derived from ConnectionError. 2013-10-04 16:07:11 +10:00
David Pursehouse
82e6706722 Minor doc updates
- Improve wording of sentence describing proxy environment
  variable setting.
- Mention that proxy URLs must include the scheme.
2013-10-04 10:19:33 +09:00
Andrew Barnert
af4fb8cedc Accept per-file headers in multipart file POST messages.
- Each file in the `files` argument can now be a 4-tuple, instead of
  just a file, 2-tuple, or 3-tuple. If it is, the last value in the
  tuple is a dictionary of extra headers.
2013-09-30 17:07:13 -07:00
daftshady
c8fc19a779 add myself to authors. 2013-09-29 02:27:20 +09:00
daftshady
012f0334ce added param to cookiejar_from_dict instead of creating new method. 2013-09-29 01:08:58 +09:00
Cory Benfield
0051837af4 Correctly lowercase a redirect scheme. 2013-09-28 17:01:32 +01:00
Cory Benfield
8b7fcfb49a Don't send the full URL on CONNECT messages. 2013-09-28 15:46:43 +01:00
daftshady
d22eaf96e2 Fixed #1630 2013-09-28 23:44:27 +09:00
daftshady
373166d833 checkout auth 2013-09-28 16:41:08 +09:00
daftshady
39fe0068aa Fixed #1630, added test case for cookie persistence. 2013-09-28 16:33:05 +09:00
daftshady
1d1831ba40 fixed extra bonus bug 2013-09-27 22:17:40 +09:00
daftshady
3501ea4634 Fixed #1623. Added 'MD5-sess' algorithm to HTTPDigestAuth 2013-09-26 15:40:12 +09:00
Cory Benfield
9968a10fcf Typo in changelog. 2013-09-25 14:00:17 +01:00
Kenneth Reitz
768b175fee Merge pull request #1621 from davidfischer/migrate-2-0
Added migrating to 2.x docs
2013-09-24 19:02:18 -07:00
David Fischer
a17f5592f8 Added link to @Lukasa's blog - the source material 2013-09-24 18:59:04 -07:00
David Fischer
fbb8d32c4e Added migrating to 2.x docs 2013-09-24 18:35:22 -07:00
Kenneth Reitz
4401620111 add history to the docs 2013-09-24 15:08:12 -04:00
Kenneth Reitz
b8a8835151 readme fix 2013-09-24 14:41:39 -04:00
Kenneth Reitz
4f463e897a Merge remote-tracking branch 'origin/master' 2013-09-24 14:31:25 -04:00
Kenneth Reitz
58eacfa1ad Merge pull request #1619 from Lukasa/master
Up to date CL.
2013-09-24 11:31:13 -07:00
Kenneth Reitz
c93419f512 TimeoutSauce! 2013-09-24 14:31:00 -04:00
Cory Benfield
53ba629a23 Up to date CL. 2013-09-24 19:26:31 +01:00
Kenneth Reitz
62925fb668 note on timeouts 2013-09-24 14:22:02 -04:00
Kenneth Reitz
94da24e387 v2.0.0 2013-09-24 14:19:07 -04:00
Kenneth Reitz
2d283c9f2d 2.0.0 2013-09-24 14:17:17 -04:00
Kenneth Reitz
54ad646067 merge 2.0 insto master 2013-09-24 14:13:28 -04:00
Kenneth Reitz
12760f2295 runscope! 2013-09-24 14:08:28 -04:00
Kenneth Reitz
c64c0ab121 prototype for new urllib3 timeouts 2013-09-24 14:06:24 -04:00
Kenneth Reitz
2f39e0e2aa new urllib3 2013-09-24 13:59:38 -04:00
Kenneth Reitz
23ced527f7 Merge pull request #1503 from skastel/master
Fixing error return to be consistent with tuple return at the end of the method
2013-09-24 10:48:07 -07:00
Kenneth Reitz
2affd6385e Merge pull request #1602 from sigmavirus24/handle_multiple_qop_types
Handle multiple qop types
2013-09-24 10:46:16 -07:00
Kenneth Reitz
58376489af Merge pull request #1585 from rvoicilas/master
Use values() when the keys are not being used
2013-09-24 10:45:46 -07:00
Kenneth Reitz
a2dbf54456 Merge pull request #1541 from Lukasa/releasenote
[2.0] Tracking PR for the 2.0 changelog
2013-09-24 10:45:11 -07:00
Kenneth Reitz
03d844f926 Merge pull request #1565 from Lukasa/relative
Don't absolute import things we've vendored.
2013-09-24 10:39:09 -07:00
Kenneth Reitz
9ffc5e6a95 runscope 2013-09-24 13:31:29 -04:00
Ian Cordasco
22e31b4b73 Handle case when WWW-Authenticate returns multiple qops
In Digest Access Authentication there are two possible values (four if you
count the not-present and both cases) for authentication. We were narrowly
handling one of the four cases. Now we handle two.
2013-09-13 22:29:42 -05:00
Kenneth Reitz
c0e9f411fc Merge pull request #1598 from Lukasa/defaults
[2.0] Python default arguments are hard
2013-09-13 06:17:41 -07:00
Cory Benfield
61421843bc Python defaults arguments are hard. 2013-09-13 14:10:09 +01:00
Cory Benfield
ce6762ff63 Fixup unicode in AUTHORS file 2013-09-12 10:34:34 +01:00
Cory Benfield
d8f2463b57 Merge pull request #1592 from homm/master
remove extra mention of dangerous `r.raw`
2013-09-12 02:29:16 -07:00
homm
f0c592b09e Update AUTHORS.rst 2013-09-12 13:27:06 +04:00
homm
a4cd1a85d6 fix spelling 2013-09-12 13:21:54 +04:00
homm
3440fca2e8 clearly describe r.raw in Body Content Workflow 2013-09-12 13:13:51 +04:00
homm
10b6d77945 remove extra mention of dangerous r.raw 2013-09-12 10:20:47 +04:00
Cory Benfield
917a15f154 Merge pull request #1591 from sayanchowdhury/patch-1
minor typo: Fix requests spelling
2013-09-11 08:16:29 -07:00
Sayan Chowdhury
0a52d9405e minor typo: Fix requests spelling 2013-09-11 20:21:57 +05:30
Cory Benfield
cde6fdd00f Merge pull request #1587 from kracekumar/patch-1
Fixed persistence spelling
2013-09-10 06:43:04 -07:00
kracekumar
a829ef9b46 Fixed persistence spelling 2013-09-10 17:52:29 +05:30
Radu Voicilas
056da86f6d Use values() when the keys are not being used 2013-09-09 15:21:36 +03:00
Cory Benfield
c1eb7027fc Merge pull request #1579 from yang/patch-1
Clarify timeout behavior in quickstart doc
2013-09-08 08:05:00 -07:00
Yang Zhang
2cb523b267 Fix typo in Timeouts doc 2013-09-07 00:16:09 -07:00
Yang Zhang
6d0315f78f Clarify timeout behavior in quickstart doc 2013-09-06 19:27:57 -07:00
Cory Benfield
b891877ee6 Merge pull request #1578 from jparise/jparise-authors
Adding myself to the list of contributors.
2013-09-04 23:44:28 -07:00
Jon Parise
9d0d11a369 Adding myself to the list of contributors. 2013-09-04 09:00:03 -07:00
Kenneth Reitz
6c73d864ef Merge pull request #1575 from jparise/content-encoding
Improved content encoding detection.
2013-09-03 19:42:43 -07:00
Jon Parise
b9b5be7c4c Improved content encoding detection.
get_encodings_from_content() can now detect HTML in-document content
encoding declarations in the following formats:

 - HTML5
 - HTML4
 - XHTML 1.x served with text/html MIME type
 - XHTML 1.x served as XML

Ref: http://www.w3.org/International/questions/qa-html-encoding-declarations
2013-09-03 16:16:46 -07:00
Cory Benfield
d991fb032a Merge pull request #1566 from sigmavirus24/update_readme
Add link to Contributor Friendly tag in README
2013-09-01 11:25:04 -07:00
Ian Cordasco
9f42a50742 Add link to Contributor Friendly tag
Add note that I'm willing to help anyone who is looking to submit a pull request
2013-09-01 13:21:55 -05:00
Cory Benfield
88011f4032 Bring release note current to 1st Sept. 2013-09-01 18:46:46 +01:00
Cory Benfield
1aa7658256 Don't absolute import vendored things. 2013-09-01 18:10:09 +01:00
Cory Benfield
e77344345a Merge pull request #1556 from ssbarnea/master
Added link to StackOverflow questions related to python-requests. This s...
2013-08-27 08:03:33 -07:00
Sorin Sbarnea
a0ffeaa56e Added link to StackOverflow questions related to python-requests. This should be the default support way for the library, as clearly most questions are supposed to be programming related.
Signed-off-by: Sorin Sbarnea <sorin.sbarnea@citrix.com>
2013-08-27 15:39:07 +01:00
Kenneth Reitz
efbae1855b Merge pull request #1552 from Lukasa/noproxy
Allow spaces in the no_proxy environ variable
2013-08-23 17:23:57 -07:00
Cory Benfield
f040b2aa5d Allow spaces in the no_proxy environ variable. 2013-08-23 12:37:03 +01:00
Kenneth Reitz
09c52e7282 Merge pull request #1537 from Lukasa/datetime
Allow non-string objects to be posted as data alongside files.
2013-08-21 11:46:27 -07:00
Kenneth Reitz
4b6649e37b Merge pull request #1527 from paul-matthews/restrict-hooks-access
Raise an error for unsupported hook event
2013-08-21 11:28:23 -07:00
Kenneth Reitz
aeeb0af3a2 Merge pull request #1536 from Lukasa/IOError
RequestsException subclasses IOError
2013-08-21 11:25:20 -07:00
Cory Benfield
148c1b5c13 Begin work on the 2.0 changelog. 2013-08-19 13:28:05 +01:00
Cory Benfield
377ac9501a Merge pull request #1540 from libbkmz/master
Event hooks update
2013-08-18 13:03:03 -07:00
libbkmz
78e5262dbd Update advanced.rst 2013-08-19 00:01:37 +04:00
Cory Benfield
0f40290039 Merge pull request #1538 from enkore/patch-1
Remove superfluous double dot
2013-08-17 23:26:59 -07:00
enkore
4ffc3e4d1f Remove superfluous double dot 2013-08-18 03:06:34 +02:00
Cory Benfield
f44b86e039 Allow non-string objects to be data with files 2013-08-17 07:27:58 +01:00
Cory Benfield
3bc01eed6f RequestException subclasses IOError. 2013-08-17 07:17:03 +01:00
Kenneth Reitz
3dc61e5d68 Merge pull request #1535 from sigmavirus24/ignore_original_response_if_none
Skip cookie extraction if necessary
2013-08-16 20:15:18 -07:00
Ian Cordasco
98680b64f4 Skip cookie extraction if necessary
If _original_response is never set/is None, then don't try to extract cookies
from the response.
2013-08-16 21:38:20 -05:00
Kenneth Reitz
d8268fb7b4 Merge pull request #1515 from schlamar/https-proxy-2.0
[2.0] Https proxy support
2013-08-14 13:41:08 -07:00
Cory Benfield
2e5a674601 Add proxy_headers functionality.
This brings us in line with urllib3's fancy new magic for sending
headers to HTTP(S) proxies.
2013-08-14 09:47:44 +01:00
Paul Matthews
61617e74ed Raise an error for unsupported hook event
* Raises a ValueError for an unsupported hook event
2013-08-12 15:27:17 +01:00
Stephen Huenneke
b676bf3214 Fixing tests to verify thrown ValueError's. 2013-08-08 09:20:41 -07:00
Stephen Huenneke
9dd823c289 Raising ValueError's when we're passed inconsistent POST data and files dict. 2013-08-06 11:04:03 -07:00
Kenneth Reitz
d3b786399e Merge pull request #1516 from Lukasa/io
UnsupportedOperation errors
2013-08-06 08:43:44 -07:00
Cory Benfield
a5e5a51fb4 Catch UnsupportedOperation. 2013-08-03 19:24:23 +01:00
schlamar
09d97c1126 Added entry to AUTHORS. 2013-08-03 13:59:38 +02:00
schlamar
6a3ca7372f Added proxy support to feature list. 2013-08-03 13:59:38 +02:00
ms4py
c951f0543c Cache manager for proxy connection. 2013-08-03 13:59:28 +02:00
ms4py
134699faf9 Fix for new proxy API. 2013-08-03 13:57:15 +02:00
ms4py
d06dabab59 Update urllib3 to 14b8945 2013-08-03 13:55:19 +02:00
Kenneth Reitz
a05aba1033 Merge pull request #1514 from Lukasa/verror
Better percent-escape exception.
2013-08-02 09:48:33 -07:00
Cory Benfield
5a26241287 Better percent-escape exception. 2013-08-02 12:29:23 +01:00
Kenneth Reitz
abfb38bd57 Merge pull request #1508 from dieterv/master
remove duplicate comment
2013-07-31 18:36:07 -07:00
Kenneth Reitz
bd1f1404a0 Merge branch 'fix_401_cookies' of git://github.com/sigmavirus24/requests into 2.0 2013-07-31 21:33:24 -04:00
Kenneth Reitz
f865d61713 Merge branch 'proxyscheme' of git://github.com/Lukasa/requests into 2.0 2013-07-31 21:27:01 -04:00
Kenneth Reitz
1a6637c285 Merge branch 'keytype' of git://github.com/Lukasa/requests into 2.0 2013-07-31 21:25:57 -04:00
Kenneth Reitz
22701d149a Merge pull request #1500 from gavrie/master
Update urllib3 to d89d508
2013-07-31 18:23:43 -07:00
Kenneth Reitz
d5fd3d3331 Merge pull request #1487 from dpursehouse/rewrite-test_mixed_case_scheme_acceptable
Rewrite test cases to remove dependency on httpbin.org and example.com
2013-07-31 18:23:34 -07:00
Kenneth Reitz
d5a8816926 Merge pull request #1498 from Lukasa/incompleteread
Wrap IncompleteRead in ChunkedEncodingError.
2013-07-31 18:23:14 -07:00
Kenneth Reitz
6b13ecdc85 Merge pull request #1501 from sigmavirus24/remove_setting_of_hooks
Fix duplication of efforts caught by @dofelw
2013-07-31 18:22:58 -07:00
Kenneth Reitz
7eb9a9298e Merge pull request #1506 from Lukasa/mockrequest
Provide 'host' parameter to MockRequest.
2013-07-31 18:22:02 -07:00
Kenneth Reitz
3e6e68baa1 Merge pull request #1507 from buzztabapp/prepared-session-requests
Allow preparing of Requests from Session settings without sending.
2013-07-31 18:21:28 -07:00
Robert Estelle
0ab7a52f7c Merge settings when creating PreparedRequest, don't copy Request. 2013-07-31 13:42:02 -07:00
Dieter Verfaillie
852de116dd remove duplicate comment
This is already mentioned at line 357...
2013-07-31 09:29:24 +02:00
Robert Estelle
0eccb547a2 Add Session.prepare_request test case. 2013-07-30 23:02:13 -07:00
Robert Estelle
d4385f6fc8 Add Request.copy() test case. 2013-07-30 23:01:56 -07:00
Robert Estelle
ee90f0af60 Shallow copy of Request fields in Request.copy()
This prevents e.g. modifying the headers of a copied request from
affecting the headers of its source and vice versa. Copying is used with
the intent to mutuate, so allowing this kind of mutation of fields makes
sense.

Is a deep copy better?
2013-07-30 22:59:53 -07:00
Robert Estelle
9edba838b3 Skip unneccessary Request.copy in Session.request 2013-07-30 22:59:11 -07:00
Robert Estelle
b5c136152f Prepare requests with session settings separately from sending. 2013-07-30 21:39:36 -07:00
Cory Benfield
6ef3710970 Provide 'host' parameter to MockRequest. 2013-07-30 18:21:37 +01:00
Stephen Huenneke
f75ee9fb6e Making sure we check for str/unicode. 2013-07-29 14:42:47 -07:00
Stephen Huenneke
8d9d9fb064 Fixing error return to be consistent with tuple return at the end of the method. 2013-07-29 13:31:06 -07:00
Cory Benfield
7de6b1e162 Instantiate the CID directly.
No need to do this the slow way now. Thanks to Colin (@cdunklau) for the
idea.
2013-07-29 14:52:44 +01:00
Cory Benfield
ec2859c0de Modify new CID tests to use native string keys. 2013-07-29 14:52:44 +01:00
Cory Benfield
f5775594cc Header keys should be native strings.
This commit follows a discussion on IRC. For more information, see the
Pull Request associated with it.
2013-07-29 14:52:44 +01:00
Ian Cordasco
37786613e0 Fix duplication of efforts caught by @dofelw 2013-07-29 08:09:07 -05:00
Gavrie Philipson
ea2b639d31 Update urllib3 to d89d508 2013-07-29 11:29:41 +03:00
Cory Benfield
79f3e69f5e Wrap IncompleteRead in ChunkedEncodingError. 2013-07-28 07:42:17 +01:00
Cory Benfield
840540b6b1 Proxy urls should have explicit schemes. 2013-07-28 07:16:06 +01:00
Cory Benfield
9473f15909 Merge pull request #1494 from Lukasa/close
Document the Response.close() method.
2013-07-27 23:04:34 -07:00
Ian Cordasco
286ddb672d Take advantage of the new copy method 2013-07-27 23:08:46 -04:00
Ian Cordasco
972089826e Fixed finally. Also requires updated httpbin.org 2013-07-27 23:07:25 -04:00
Ian Cordasco
c25a72ea24 Make the regular tests pass
I broke Digest Auth completely
2013-07-27 23:07:25 -04:00
Ian Ross and Ian Cordasco
73635df1b2 Start work on sending cookies back
On 401's the cookies received aren't sent back to the server. See: #1336
2013-07-27 23:07:25 -04:00
Kenneth Reitz
77bd9c4a9d Merge pull request #1476 from sigmavirus24/add_copy_to_prepared_requests
[2.0] Add copy method to PreparedRequest objects
2013-07-26 18:16:00 -07:00
Cory Benfield
f401287afb Document the Response.close() method. 2013-07-25 19:10:42 +01:00
Cory Benfield
3becc47366 Comment markups, courtesy of @sigmavirus24 2013-07-24 16:03:24 +01:00
Kenneth Reitz
7d3d074e66 Merge pull request #1490 from Lukasa/cookiedocs
Better cookie docs on sessions.
2013-07-24 06:12:10 -07:00
Cory Benfield
f40a1d6a8a Better cookie docs on sessions. 2013-07-24 13:25:59 +01:00
David Pursehouse
82c9aa912e Check the response URL in test_uppercase_scheme_redirect
Update the test to check that the URL in the response is the
one that we expect, i.e. the one it was supposed to redirect to.
2013-07-24 17:37:35 +09:00
David Pursehouse
56b5f02551 Rewrite test_uppercase_scheme_redirect to use local httpbin
Instead of redirecting to hard-coded 'example.com', use the URL
defined in `HTTPBIN_URL` with the path set to the 'html' endpoint.
2013-07-24 17:18:16 +09:00
David Pursehouse
c4f16c351c Remove redundant test case test_uppercase_scheme
This test verifies that an upper case scheme ('HTTP') works correctly,
but this is already tested in `test_mixed_case_scheme_acceptable`.
2013-07-24 16:58:09 +09:00
David Pursehouse
012cc33d44 Rewrite test_mixed_case_scheme_acceptable to work with local httpbin
Instead of using hard-coded urls to httpbin.org, use the url defined
in `HTTPBIN_URL` replacing the scheme as necessary to test the mixed
cases.

Refs #1485
2013-07-24 16:36:10 +09:00
David Pursehouse
415fb53cb4 Remove redundant session in test_mixed_case_scheme_acceptable 2013-07-24 12:15:46 +09:00
Kenneth Reitz
b65b8c5ed3 Merge pull request #1486 from sigmavirus24/use_urljoin
Use urlparse.urljointo construct httpbin url
2013-07-23 09:03:05 -07:00
Ian Cordasco
c0cb698191 Derp. Use compat 2013-07-23 10:48:45 -05:00
Ian Cordasco
d2176cf052 Use urlparse.urljointo construct httpbin url 2013-07-23 10:24:30 -05:00
Kenneth Reitz
f71bff1226 Merge pull request #1482 from dpursehouse/fix-testcases-with-proxy
Fix test cases that fail when running behind a proxy
2013-07-23 05:23:35 -07:00
Kenneth Reitz
47f5a0db64 Merge pull request #1483 from dpursehouse/httpbin-url-without-trailing-slash
Test cases fail when `HTTPBIN_URL` does not have trailing slash
2013-07-23 05:23:11 -07:00
David Pursehouse
9e771aa79c Fix test cases that fail when running behind a proxy
When sending a request via `Session.send()` the proxies must be
explicitly given with the `proxies` argument.  This is not done
in the test cases, which means that they fail when run on a system
that is behind a proxy.

Update test cases to make sure the proxies are set in the sessions.
2013-07-23 16:55:27 +09:00
David Pursehouse
29db7b7216 Test cases fail when HTTPBIN_URL does not have trailing slash
Test cases can be run against a local httpbin server defined by
the `HTTPBIN_URL` environment variable, but it causes tests to
fail if the given URL does not end with a slash.

Ensure that the URL always ends with a slash.
2013-07-23 15:29:36 +09:00
Kenneth Reitz
66de6b528d Merge pull request #1479 from dpursehouse/fix-warnings
Fix a few warnings flagged by PyDev
2013-07-22 01:31:16 -07:00
David Pursehouse
4f64938ff0 Fix a few warnings flagged by PyDev
- Unused import of urlparse
- Unnecessary definition of variable
- Incorrect indentation
2013-07-22 17:14:45 +09:00
Kenneth Reitz
e5597dfcce Merge pull request #1478 from dpursehouse/add-me-to-authors
Add myself to the authors list
2013-07-22 00:09:35 -07:00
David Pursehouse
787c1e8c6e Add myself to the authors list 2013-07-22 15:19:10 +09:00
Cory Benfield
ec6584f2d1 Merge pull request #1477 from dpursehouse/other-auth-basic-example
Add a simple example of custom authentication in the documentation
2013-07-21 23:04:31 -07:00
David Pursehouse
62f0df4434 Add a simple example of custom authentication in the documentation
Refs #1471
2013-07-22 09:14:33 +09:00
David Pursehouse
5cdcf58b3b Wrap long lines in the authentication documentation 2013-07-22 09:08:47 +09:00
Ian Cordasco
b84547d786 Add copy method to PreparedRequest objects 2013-07-20 17:08:35 -04:00
Kenneth Reitz
d83919a6f7 Merge pull request #1474 from Kwpolska/docfix
Some tiny fixes to the documentation
2013-07-20 05:15:06 -07:00
Kwpolska
2ef782b8e6 further treatment
Signed-off-by: Kwpolska <kwpolska@gmail.com>
2013-07-20 13:54:33 +02:00
Kwpolska
b738c97ec3 session object should be uppercase
Signed-off-by: Kwpolska <kwpolska@gmail.com>
2013-07-20 13:39:50 +02:00
Kwpolska
022c370bcd fixed underline
Signed-off-by: Kwpolska <kwpolska@gmail.com>
2013-07-20 13:31:37 +02:00
Kwpolska
587385bfe0 Grammar fixes and such
Signed-off-by: Kwpolska <kwpolska@gmail.com>
2013-07-20 12:56:25 +02:00
Kwpolska
ca033b83fe Some cosmetic updates to the docs
Signed-off-by: Kwpolska <kwpolska@gmail.com>
2013-07-20 12:12:57 +02:00
Cory Benfield
949a29c34f Merge pull request #1470 from Lukasa/carset
Remove charset from JSON types: not valid.
2013-07-19 06:45:56 -07:00
Cory Benfield
be884341f4 Merge pull request #1465 from dpursehouse/doc-netrc-authentication
Improve documentation of netrc authentication
2013-07-19 06:45:17 -07:00
David Pursehouse
c88fd8cc9d Move netrc authentication documentation under the Basic Auth section 2013-07-19 22:37:57 +09:00
Cory Benfield
8385fb397b Remove charset from JSON types: not valid. 2013-07-19 14:03:20 +01:00
Cory Benfield
e0df4b5f18 Merge pull request #1466 from s7v7nislands/fix_doc
Fix doc
2013-07-19 04:12:29 -07:00
s7v7nislands
39ad5e7388 merge 2013-07-19 17:12:01 +08:00
s7v7nislands
0df505bd7c fix doc 2013-07-19 17:04:53 +08:00
David Pursehouse
6f6a920a68 Improve documentation of netrc authentication
The documentation does not make it clear that when the credentials
from netrc are used, Requests authenticates with HTTP Basic Auth.

I just spent ages trying to figure out why it wasn't working, and
it was because although the credentials in the netrc were correct,
the server actually required HTTP Digest Auth.

Add a section in the authentication documentation to make it clear
that HTTP Basic Auth is used.
2013-07-19 17:30:54 +09:00
Cory Benfield
32293655ff Merge pull request #1464 from dpursehouse/document-none-not-sent
Fix #1322: Add note in docs about None not being sent as data
2013-07-19 01:19:55 -07:00
David Pursehouse
07ad75ee04 Fix #1322: Add note in docs about None not being sent as data
In the case:

  payload = {'key1': 'value1', 'key2': 'value2', 'key3': None}
  r = requests.get("http://httpbin.org", params=payload)

the parameter `key3` will not be sent as a parameter in the URL.

Mention this in the documentation.
2013-07-19 17:14:59 +09:00
Kenneth Reitz
e4b41320e6 Merge pull request #1463 from AudriusButkevicius/master
Update urllib3 to a43319f
2013-07-18 15:00:28 -07:00
Audrius Butkevicius
9f119ee420 Update urllib3 to a43319f 2013-07-18 21:06:19 +00:00
Kenneth Reitz
e0df2168b7 Merge remote-tracking branch 'origin/master' 2013-07-16 02:20:28 -04:00
Kenneth Reitz
d7e8073198 badge.fury.io 2013-07-16 02:20:23 -04:00
Kenneth Reitz
65a0fd88a9 Merge pull request #1440 from fcurella/patch-0
unquote double-quotes cookie values
2013-07-15 06:54:00 -07:00
Kenneth Reitz
4b7cf389e4 Merge pull request #1439 from voberoi/master
Make sure netrc doesn't override any authentication settings explicitly set by the client
2013-07-15 06:22:53 -07:00
Kenneth Reitz
86d466c745 Merge pull request #1441 from Lukasa/1395
Remove urllib3-specific kwargs from non-urllib3 branch.
2013-07-15 06:22:41 -07:00
Kenneth Reitz
de9d84489b Merge pull request #1456 from phndiaye/master
Changed the "im_used" informational status code for the value given by IANA (226)
2013-07-15 06:21:31 -07:00
Philippe Ndiaye
18a736fbe6 Set 208 status_code to "already_reported" 2013-07-13 11:08:01 +02:00
Philippe Ndiaye
7bdf37bc27 Changed the "im_used" informational status code for the value given by IANA (226)
See RFC 3229 at http://tools.ietf.org/html/rfc3229#section-10.4.1 and HTTP status codes at http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
2013-07-13 09:55:50 +02:00
Kenneth Reitz
41517e2111 Delete invokefile.py 2013-07-06 14:04:50 +10:00
Cory Benfield
555472bf1e Remove urllib3-specific kwargs from general code 2013-07-04 10:34:43 +01:00
Flavio Curella
7da16c584a Added myself to AUTHORS 2013-07-01 15:54:59 -05:00
Flavio Curella
a8cf5b8502 keep the double quotes, but don't escape them 2013-07-01 15:48:48 -05:00
Flavio Curella
cdab4fabf4 unquote double-quotes cookie values 2013-07-01 13:51:40 -05:00
Vikram Oberoi
d9c49ad30d Add test to verify .netrc authentication behavior.
Here's what should happen:

- If no credentials are given, use netrc if there's a netrc entry.
- If credentials are given, they should override netrc.
2013-06-27 17:16:42 -04:00
Vikram Oberoi
188e7609b3 .netrc settings shouldn't blow away explicit auth settings on a session 2013-06-27 16:43:40 -04:00
Cory Benfield
2b62980e26 Merge pull request #1437 from lukaszb/patch-1
Fixed wrong method call at streaming example
2013-06-27 11:18:56 -07:00
Lukasz Balcerzak
805abee9b4 Fixed wrong method call at streaming example
405 is returned if POST request is performed to http://httpbin.org/stream/20
2013-06-27 13:37:39 +02:00
Kenneth Reitz
a1bb7fb0d2 Merge pull request #1435 from chinux23/master
@1434 https://github.com/kennethreitz/requests/issues/1434
2013-06-25 15:49:04 -07:00
Chen Huang
9083735963 @1434 Fix https://github.com/kennethreitz/requests/issues/1434 2013-06-25 18:38:59 -04:00
Cory Benfield
dcf20c4cfe Merge pull request #1429 from Lukasa/docs
Packaging warning, in via @andrewgross.
2013-06-24 00:48:48 -07:00
Cory Benfield
d57a5efab3 Packaging warning, in via @andrewgross. 2013-06-22 15:02:18 +01:00
Kenneth Reitz
3781c96125 Merge pull request #1425 from Lukasa/stream
Use new urllib3 'stream' parameter.
2013-06-21 02:23:10 -07:00
Cory Benfield
1faa76a86f Use the new urllib3 stream generator. 2013-06-18 17:56:35 +01:00
Cory Benfield
ecf57cac5c Update urllib3 to cffbd6b317 2013-06-18 17:47:23 +01:00
Kenneth Reitz
25db83fe85 Merge pull request #1419 from kevinburke/exception-links
Exception links
2013-06-14 22:50:44 -07:00
Kevin Burke
ba0db9db86 Add self to AUTHORS 2013-06-12 15:56:10 -07:00
Kevin Burke
a6415cf895 Link to the actual exception references
Sphinx has a neat cross-referencing feature where if you include the tilde
character in front of a :py: class, it'll link to the full object but provide
only the last part of class name in the text. For more info see
http://sphinx-doc.org/domains.html#cross-referencing-syntax
2013-06-12 15:53:09 -07:00
Kenneth Reitz
df935f5b03 Merge pull request #1414 from jschneier/master
fixed typo in docs
2013-06-12 11:12:17 -07:00
Josh Schneier
43a64d9515 fix doc typo 2013-06-09 11:14:14 -04:00
Kenneth Reitz
70a6d035d9 Merge pull request #1315 from reclosedev/fix-redirects
Don't reuse the same prepared request for all redirects
2013-06-08 03:53:16 -07:00
Roman Haritonov
716b627c1e Don't reuse PreparedRequest on redirects 2013-06-08 14:41:34 +04:00
Roman Haritonov
798a1ffdec new failing test_requests_in_history_are_not_overridden() 2013-06-08 14:41:34 +04:00
Kenneth Reitz
8028103b71 Merge pull request #1400 from jam/master
Retrieve environment proxies using standard library functions
2013-06-08 03:20:18 -07:00
Kenneth Reitz
8430e6ccbb Merge pull request #1334 from rcarz/master
resolve_redirects no longer throws an InvalidSchema exception when the scheme is uppercase
2013-06-08 03:18:25 -07:00
Kenneth Reitz
d4c461042b Merge pull request #1385 from ViktorHaag/master
Cope with mixed-case URL schemes (like 'HTTP') by lower-ifying 'url' string before calling startswith() on it
2013-06-08 03:17:38 -07:00
Kenneth Reitz
60b1a0ba13 Merge pull request #1381 from expandrive/master
Don't force chunked transfer on 0-length file-like object.
2013-06-08 03:16:32 -07:00
Kenneth Reitz
cfd84d74ee Merge pull request #1392 from revolunet/patch-2
Update quickstart.rst
2013-06-08 03:16:21 -07:00
Kenneth Reitz
eec9bdd434 Merge pull request #1408 from wasw100/master
cookies.morsel_to_cookie morsel['expires'] can't be strtime, and morsel['max-age'] convert to expires problem repair
2013-06-08 03:14:32 -07:00
Kenneth Reitz
f74d5e96dd Merge pull request #1412 from t-8ch/update_urllib3
update urllib3 to 60ba176f5d
2013-06-08 03:13:34 -07:00
Kenneth Reitz
e63e68ef48 Merge pull request #1413 from Lukasa/docs
Assorted docs updates
2013-06-08 03:13:14 -07:00
Cory Benfield
73425fbffb Remove development reference from docs sidebar. 2013-06-08 11:10:07 +01:00
Cory Benfield
f53aed1611 Document blocking calls. 2013-06-08 11:09:39 +01:00
Thomas Weißschuh
2ed976ea71 update urllib3 to 60ba176f5d 2013-06-08 08:22:15 +00:00
wasw100
767f758aac cookies.morsel_to_cookie morsel['expires'] can't be strtime, and max-age convert to expires problem repair 2013-06-07 00:02:45 +08:00
wasw100
961790f95c cookies.morsel_to_cookie(morsel) raise TypeError repaired.
morsel_to_cookie(mosel) method raise TypeError: create_cookie() got unexpected keyword arguments: ['path_specified', 'domain_specified', 'port_specified', 'domain_initial_dot'].

so we should remove these param from create_cookie(...)
2013-06-06 19:15:09 +08:00
James Clarke
f705c41c1d Added myself to AUTHORS. 2013-05-31 18:19:42 -07:00
James Clarke
93be6916f9 Use urllib to retrieve environment proxies.
This has the added benefit of including proxies defined by the OS X System Configuration framework and in the Windows registry, rather than only checking os.environ.
2013-05-31 18:19:34 -07:00
Julien Bouquillon
340931ba8e Update quickstart.rst
rephrase misleading info about `raise_for_status`
2013-05-29 12:57:49 +03:00
Bob Carroll
2c5ea69e5d rebased with upstream/master 2013-05-26 14:46:36 -07:00
Bob Carroll
d59510481a this didn't merge properly 2013-05-26 14:45:49 -07:00
Bob Carroll
f3036adc4f added assertion to test_uppercase_scheme_redirect for the response code 2013-05-26 14:44:37 -07:00
Bob Carroll
489a412f96 I probably should add my name too 2013-05-26 14:44:37 -07:00
Bob Carroll
72e155e529 resolve_redirects now checks for a scheme before converting the scheme to lowercase, added tests or the scheme casing 2013-05-26 14:44:22 -07:00
Bob Carroll
e715d7184b resolve_redirects no longer throws an InvalidSchema exception when the scheme is uppercase 2013-05-26 14:43:00 -07:00
Kenneth Reitz
3bb13f8fbb v1.2.3 2013-05-25 12:48:10 -04:00
Viktor Haag
01993d21dc added tests for mixed-case scheme URLs, changed adapters passing down URLs into urllib3 by lower-ifying them so that the underlying pool manager can effectively pool by scheme as dictionary key 2013-05-24 16:14:14 -04:00
Viktor Haag
5e94f38001 - fixed func call syntax on lower to lower()
- added test cases for trying to test GETS on mixed-case schemas
2013-05-24 14:01:30 -04:00
Viktor Haag
3004ad5398 Lower-ify url before checking against prefix with startswith() 2013-05-24 11:26:00 -04:00
Jeff Mancuso
e7c9bbb96f Only switch to chunked if we don't know the length of a file like object. This fixes the case of trying to upload a 0-length file - chunked upload was being forced. Services like S3 that disallow chunked upload will fail. 2013-05-23 11:21:29 -04:00
Kenneth Reitz
00ab8fbfea Merge remote-tracking branch 'origin/master' 2013-05-21 17:43:53 -04:00
Kenneth Reitz
9930c9c737 v1.2.2 2013-05-21 17:43:13 -04:00
Kenneth Reitz
2ee814d924 Merge pull request #1375 from t-8ch/fix_digest_auth
don't replace 'Digest' in digest header value
2013-05-21 14:33:25 -07:00
Kenneth Reitz
8b55a253b1 Merge remote-tracking branch 'origin/master' 2013-05-21 17:27:15 -04:00
Kenneth Reitz
786fe94ac4 nope 2013-05-21 17:27:06 -04:00
Kenneth Reitz
fede8e5af3 Merge pull request #1376 from papaeye/master
Fix typo, %t -> %r
2013-05-21 14:25:49 -07:00
papaeye
2a34335dc3 Fix #1374 2013-05-22 04:30:19 +09:00
Thomas Weißschuh
3b0d8b8e39 don't replace 'Digest' in digest header value
See https://github.com/kennethreitz/requests/issues/1358
2013-05-21 17:48:30 +00:00
papaeye
715a57dec8 Fix typo, %t -> %r 2013-05-22 02:20:51 +09:00
Kenneth Reitz
2aabb71dc8 Merge pull request #1373 from ib-lundgren/unicode_fields_to_urllib
Only pass unicode multipart fieldnames to urllib3.
2013-05-21 06:19:48 -07:00
Ib Lundgren
003c795afe Only pass unicode fieldnames to urllib3. 2013-05-21 09:46:28 +01:00
Kenneth Reitz
1621015e00 Merge pull request #1343 from gazpachoking/#1321
Refactor merge_kwargs
2013-05-20 19:14:54 -07:00
Chase Sterling
98114245c6 Refactor merge_kwargs for clarity and to fix a few bugs 2013-05-20 21:20:51 -04:00
Kenneth Reitz
8eb4243f12 Merge remote-tracking branch 'origin/master' 2013-05-20 16:10:43 -04:00
Kenneth Reitz
569b59f495 v1.2.1 2013-05-20 16:10:23 -04:00
Kenneth Reitz
8f42369aa9 Merge pull request #1356 from Zoramite/ConnectionPoolArgs
Adding an argument to the adapter for passing a block argument
2013-05-20 13:05:02 -07:00
Kenneth Reitz
f4e7809e7c Merge pull request #1361 from Lukasa/1360
Always percent-encode location headers.
2013-05-20 13:04:08 -07:00
Kenneth Reitz
2afe3b2e99 Merge pull request #1370 from sigmavirus24/origin_req_host
Add an extra property for Python 3.3
2013-05-20 12:57:38 -07:00
Ian Cordasco
9ce7f0bf5b Attempt a fix for @michaelhelmick 2013-05-20 10:58:03 -04:00
Kenneth Reitz
7430a49f45 Merge remote-tracking branch 'origin/master' 2013-05-17 09:31:11 +02:00
Kenneth Reitz
538dbaecbe download image! 2013-05-17 09:31:01 +02:00
Kenneth Reitz
5943afa25d Merge pull request #1363 from dave-shawley/master
Fix for #1362
2013-05-16 23:23:04 -07:00
Dave Shawley
6e76ab7188 Fix for #1362.
`PreparedRequest.prepare_url` incorrectly applied IDNA encoding to the
URLs entire `netloc`.  It should only be encoding the hostname portion
of the URL.  IDNA encoding was limiting the user info, host, and port
segments to be a maximum of 63 characters which causes problems for
all by the most trivial user + password combinations.

- Replaced usage of `urlparse` in `PreparedRequest.prepare_url` with
  `urllib3` equivalent.
- Modified IDNA encoding section so that it only encodes the host
  portion of the URL.
2013-05-16 13:12:34 -04:00
Cory Benfield
2b6ebd2521 Always percent-encode location headers. 2013-05-16 12:02:46 +01:00
Kenneth Reitz
eacb91afb1 Merge pull request #1327 from ambv/adapter_order
Fixes #1320: transport adapters stored in ordered form
2013-05-15 09:43:57 -07:00
Łukasz Langa
4c8af1fff4 Fixes #1320: transport adapters stored in ordered form 2013-05-15 13:34:09 +02:00
Randy Merrill
c03e14242b Adding the _pool_bloc to the list of attrs. 2013-05-11 18:30:31 -07:00
Randy Merrill
9cb3d6444d Fixing the call to init_poolmanagers to correctly unpickle the adapter. 2013-05-11 18:13:08 -07:00
Randy Merrill
053613688b Moving the order of the arguments in the init to not interfere with existing usage. 2013-05-11 18:04:43 -07:00
Randy Merrill
2eb682671d Adding an argument to the adapter for passing a block argument to the connection pool.
This allows for blocking when using threading to prevent the pool from creating more connections that the max-size allows.

Specifically was seeing the following errors without the block=True:

    WARNING:requests.packages.urllib3.connectionpool:HttpConnectionPool is full, discarding connection: www.example.com
2013-05-10 23:46:54 -07:00
Kenneth Reitz
e7786ec14f Merge pull request #1355 from sigmavirus24/fix_links
Prevent a KeyError when there's no link headers
2013-05-09 01:03:49 -07:00
Ian Cordasco
88fda94218 Prevent a KeyError when there's no link headers 2013-05-08 23:26:49 -04:00
Kenneth Reitz
b599886beb Merge pull request #1352 from nicoddemus/docs-link-on-readme
Adding link to documentation in README.rst
2013-05-07 10:01:32 -07:00
Kenneth Reitz
7aedc6bb22 Merge pull request #1342 from mexicat/master
Fixed example in authentication docs
2013-05-07 10:01:18 -07:00
Bruno Oliveira
efefc6b778 Adding link to documentation in README.rst
Just adding a link to the documentation at python-requests.org
2013-05-06 23:46:59 -03:00
Kenneth Reitz
50e592209f Merge pull request #1347 from hobarrera/master
Issue #749: Add optional SNI support for python2.
2013-05-04 13:11:46 -07:00
Hugo Osvaldo Barrera
18857a0eed Issue #749: Add optional SNI support for python2.
SNI support will be enabled for python2 if ndg-httpsclient and pyopenssl are available.
2013-05-03 21:05:42 -03:00
giacomo
8781b56a0e Fixed example in authentication docs 2013-05-02 18:16:19 +03:00
Kenneth Reitz
e585e496c9 Merge pull request #1341 from cdunklau/docstring_test_1329
Minor update to tests, added docstrings
2013-05-01 11:40:02 -07:00
Colin Dunklau
f93275c47f Minor update to tests, added docstrings
Requested by @sigmavirus24.
2013-05-01 12:51:09 -05:00
Kenneth Reitz
4f83ef8328 Merge pull request #1314 from duailibe/master
Fix small typo in the Support docs
2013-05-01 10:29:40 -07:00
Kenneth Reitz
0f1bb96f01 Merge pull request #1337 from amercader/master
Fix minor issues on the API docs
2013-05-01 10:28:18 -07:00
Kenneth Reitz
e6e9b550c0 Merge pull request #1339 from cdunklau/case_insensitive_headers_cleanup
Rewrite CaseInsensitiveDict to work correctly/sanely
2013-05-01 10:27:58 -07:00
Kenneth Reitz
f8f1db8458 Merge pull request #1340 from ambv/tox_ini
Remove 3.1 and 3.2 from setup.py, add tox.ini to simplify testing on multiple versions
2013-05-01 10:27:02 -07:00
Łukasz Langa
7e825acd9b Remove Python 3.1 and 3.2 from the trove classifiers in setup.py 2013-05-01 19:26:12 +02:00
Colin Dunklau
f7596c75dc Rewrite CaseInsensitiveDict to work correctly/sanely
Fixes #649 and #1329 by making Session.headers a CaseInsensitiveDict,
and fixing the implementation of CID. Credit for the brilliant idea
to map `lowercased_key -> (cased_key, mapped_value)` goes to
@gazpachoking, thanks a bunch.

Changes from original implementation of CaseInsensitiveDict:

1.  CID is rewritten as a subclass of `collections.MutableMapping`.
2.  CID remembers the case of the last-set key, but `__setitem__`
    and `__delitem__` will handle keys without respect to case.
3.  CID returns the key case as remembered for the `keys`, `items`,
    and `__iter__` methods.
4.  Query operations (`__getitem__` and `__contains__`) are done in
    a case-insensitive manner: `cid['foo']` and `cid['FOO']` will
    return the same value.
5.  The constructor as well as `update` and `__eq__` have undefined
    behavior when given multiple keys that have the same `lower()`.
6.  The new method `lower_items` is like `iteritems`, but keys are
    all lowercased.
7.  CID raises `KeyError` for `__getitem__` as normal dicts do. The
    old implementation returned
6.  The `__repr__` now makes it obvious that it's not a normal dict.

See PR #1333 for the discussions that lead up to this implementation
2013-04-30 14:52:27 -05:00
amercader
505d2487e3 Fix API documentation issues
* 'Cookies' and 'Encodings' sections were not built because the
  reference to the functions was wrong.
* 'Exceptions' section had a wrong anchor link ('module-requests', same
   one as the main heading).
* Remove 'decode_gzip' function, which is no longer present.
2013-04-30 16:15:56 +02:00
Kenneth Reitz
ab36f3cc6f Merge pull request #1332 from bboe/urllib3
Update urllib3 to 59de03e6163c6928dc01832ed6e48e9f6c34c795.
2013-04-28 16:58:08 -07:00
Bryce Boe
49ca72c802 Update urllib3 to 59de03e6163c6928dc01832ed6e48e9f6c34c795.
This update includes two fixes:

* https://github.com/shazow/urllib3/issues/149
* https://github.com/shazow/urllib3/issues/174
2013-04-27 14:33:39 -07:00
Kenneth Reitz
d2ba5798ec Merge pull request #1330 from Kwpolska/patch-1
Fixing a tiny typo, noticed while working on the Polish translation
2013-04-27 04:53:37 -07:00
Chris Warrick
c3bef6b0d9 A tiny typo, noticed while working on the Polish translation. 2013-04-27 14:52:35 +03:00
Kenneth Reitz
98dea03710 Merge pull request #1328 from gazpachoking/session_cj_fix
Session CookieJar fix
2013-04-26 00:02:28 -07:00
Chase Sterling
0c609b59ab Fix session CookieJars without breaking more stuff this time 2013-04-25 23:15:50 -04:00
Chase Sterling
a7fef58756 Add another session cookie test 2013-04-25 23:11:43 -04:00
Chase Sterling
3ff8d43801 Fix cookielib import 2013-04-25 22:40:24 -04:00
Chase Sterling
9763a671da Fix crash when session.cookies was not a RequestsCookieJar 2013-04-25 22:34:51 -04:00
Chase Sterling
1866f7596e Add test for session cookiejars other than RequestsCookieJar 2013-04-25 22:32:03 -04:00
Kenneth Reitz
8f3f4e2744 milla 2013-04-20 00:22:13 -04:00
Kenneth Reitz
4438bfcc44 Merge remote-tracking branch 'origin/master' 2013-04-20 00:18:33 -04:00
Kenneth Reitz
65b6ef6036 pt 2013-04-20 00:18:27 -04:00
Lucas Duailibe
1ca423ec80 Fix small typo in the Support docs 2013-04-18 20:59:17 -03:00
Kenneth Reitz
770c3d7548 Merge pull request #1313 from iurisilvio/fix_max_redirects_docs
Fix max_redirects docs issue #1301
2013-04-17 12:39:03 -07:00
Iuri de Silvio
736e8cd735 Fix max_redirects docs issue #1301 2013-04-17 12:27:06 -07:00
Kenneth Reitz
6046fcffe8 Merge pull request #1279 from jemerick/unicode_multipart_post
Unicode strings in multipart post requests
2013-04-16 12:55:58 -07:00
Kenneth Reitz
d13bf9f113 support for draft-tbray-http-legally-restricted-status-02
http://datatracker.ietf.org/doc/draft-tbray-http-legally-restricted-stat
us/?include_text=1
2013-04-15 22:47:20 -04:00
Kenneth Reitz
ae5419db17 translations 2013-04-15 03:22:56 -04:00
Kenneth Reitz
9c2f9f61ef Translatoins 2013-04-15 03:22:48 -04:00
Kenneth Reitz
636476e704 Merge remote-tracking branch 'origin/master' 2013-04-15 03:21:40 -04:00
Kenneth Reitz
aafca7acdc translations 2013-04-15 03:21:32 -04:00
Kenneth Reitz
a527ecfabd Merge pull request #1242 from oviboy/master
HTTP Digest Auth case insensitive replacement of "Digest "
2013-04-13 20:28:43 -07:00
Kenneth Reitz
967cfbe663 Merge pull request #1299 from schlamar/fix-decompression
Use streaming decompression feature of urllib3.
2013-04-13 20:27:46 -07:00
Kenneth Reitz
9df450193f Merge pull request #1302 from ssbarnea/master
Documents the actual logging methods #1297
2013-04-13 20:25:47 -07:00
Kenneth Reitz
082029ff2e switch streaming requests to httpbin 2013-04-13 15:26:49 -04:00
Kenneth Reitz
c0baec1431 Merge pull request #1305 from michaelhelmick/patch-1
Fix Advanced docs Twitter Streaming example
2013-04-13 12:24:21 -07:00
Kenneth Reitz
561366cab0 Merge pull request #1309 from toastdriven/better-max-retries
Changed HTTPAdapter to allow max retries to be specified when initializing.
2013-04-13 12:05:13 -07:00
Kenneth Reitz
f0950a9e6c Merge pull request #1311 from sigmavirus24/fix1303
Change the method when it isn't already GET/HEAD
2013-04-13 12:02:29 -07:00
Ian Cordasco
c5d0a0931e Change the method when it isn't already GET/HEAD
For some reason it was only change the method when a POST was being made. This
is almost certainly my fault.

Fixes #1303
2013-04-13 12:31:22 -04:00
Daniel Lindsley
36dcce1a06 Changed HTTPAdapter to allow max retries to be specified when initializing. 2013-04-12 16:40:39 -07:00
Mike Helmick
ed0242ae3a Fix Advanced docs Twitter Streaming example
Twitter API v1.1 Streaming now requires OAuth Authentication rather than XAuth.
I believe v1 is being blacked out sometime at the beginning of May.
2013-04-11 20:19:51 -04:00
Kenneth Reitz
eda4b55f7a Merge pull request #1306 from pombredanne/patch-1
Updated NOTICE copyright from 2022 to 2012
2013-04-11 09:04:07 -07:00
pombredanne
6e3cfe5dd5 Updated NOTICE copyright from 2022 to 2012
Which is likely what you meant, eh?
2013-04-11 17:08:27 +03:00
Sorin Sbarnea
fb49481ddf Updated documentation indicating that logging is done via requests.packages.urllib3 instead of requests.
modified:   docs/api.rst
2013-04-10 16:46:05 +01:00
Sorin Sbarnea
17ecb6891c * Documented the logging, requested in #1297
* Added build directory and *.egg to .gitignore
* Added sphinx as setup requirement in order to be able to build documentation with `pyhton setup.py build_sphinx`

modified:   .gitignore
modified:   docs/api.rst
modified:   setup.py
2013-04-10 16:15:28 +01:00
schlamar
4c3432b759 Fix test with StringIO. 2013-04-10 08:24:33 +02:00
schlamar
59f916ca4a Use streaming decompression feature of urllib3. 2013-04-10 08:08:33 +02:00
schlamar
6d6252aa9f Update urllib3 to 71f84f9. 2013-04-10 08:00:36 +02:00
Kenneth Reitz
2426eeb371 Merge pull request #1298 from Lukasa/adapter_doc
Transport Adapter Docs
2013-04-09 13:17:19 -07:00
Cory Benfield
e5f1053b30 Shell of Transport Adapter documentation. 2013-04-09 20:58:59 +01:00
Cory Benfield
c73f653352 Add HTTPAdapter to API docs. 2013-04-09 19:54:47 +01:00
Kenneth Reitz
5b937b384b Merge pull request #1296 from sursh/master
Add helpful error message to r.json() method
2013-04-08 11:01:36 -07:00
Sasha Laundy
8ebeb3dc3f Make json error message more specific 2013-04-08 13:03:13 -04:00
sursh
dfa59c2d97 Fix markdown 2013-04-08 13:01:02 -03:00
sursh
511cc4c034 Make json error on empty response more specific 2013-04-08 13:00:27 -03:00
Kenneth Reitz
fa9234da05 Merge pull request #1295 from sigmavirus24/issue1293
Fix #1293
2013-04-06 17:27:23 -07:00
Ian Cordasco
afcc883d7f Fix #1293 2013-04-06 11:26:52 -04:00
Kenneth Reitz
1e465fd255 Merge pull request #1291 from gazpachoking/dont_set_session_cookies_on_response
Don't set all session cookies on response.cookies
2013-04-04 20:41:52 -07:00
Chase Sterling
49a3664222 Don't set all session cookies on response.cookies 2013-04-04 23:30:52 -04:00
Kenneth Reitz
848f2c297e Merge pull request #1290 from gazpachoking/#1287
fix #1287: Make sure expired cookies get removed from session.cookies
2013-04-04 20:22:38 -07:00
Chase Sterling
5c47ce1136 Make sure unit test works on python 2.6 2013-04-04 22:48:14 -04:00
Chase Sterling
88f13598f3 Add a unit test for server expiring cookies from session 2013-04-04 22:40:27 -04:00
Chase Sterling
d22ac00098 fix #1287: Make sure expired cookies get removed from session.cookies 2013-04-04 22:11:38 -04:00
Kenneth Reitz
dccfc5ba3c Merge pull request #1283 from sigmavirus24/master
Closes #1280
2013-04-03 18:04:40 -07:00
Jason Emerick
e7247ce3f6 model the encode_files data handling after encode_params 2013-04-02 14:22:49 -04:00
Jason Emerick
168c3e6913 add a few more variations to the unicode multipart post test 2013-04-02 14:22:12 -04:00
Jason Emerick
82d36d8259 add additional test for unicode multipart post 2013-04-02 11:41:07 -04:00
Ian Cordasco
b9e5cce2d2 Add PreparedRequest recipe to the docs 2013-04-02 10:07:37 -04:00
Ian Cordasco
1abd13700b Closes #1280
Correct the doc-string for Session#request that I copied without thinking
about.
2013-04-02 09:27:25 -04:00
Kenneth Reitz
54ed5ed469 Revert "Fix for the issue https://github.com/kennethreitz/requests/issues/1280"
This reverts commit ca0aea640d.
2013-04-02 08:13:46 -04:00
Kenneth Reitz
cdb700737b Merge pull request #1281 from KamilSzot/Issue_kennethreitz_requests_issues_1280
Fix for the issue https://github.com/kennethreitz/requests/issues/1280
2013-04-02 04:44:59 -07:00
Kamil Szot
ca0aea640d Fix for the issue https://github.com/kennethreitz/requests/issues/1280 2013-04-02 13:42:40 +02:00
Kenneth Reitz
20a8a9b681 Merge pull request #1278 from t-8ch/patch-1
fix tiny typo in HISTORY.rst
2013-04-01 21:36:49 -07:00
Kenneth Reitz
9c18febf45 Merge pull request #1277 from pborreli/typos
Fixed typos
2013-04-01 21:36:39 -07:00
Kenneth Reitz
848aca21be Merge pull request #1276 from alex/patch-1
is should not be used for comparing numbers
2013-04-01 20:42:22 -07:00
Jason Emerick
f37b968475 use compat.str instead of compat.builtin_str 2013-04-01 18:14:52 -04:00
Jason Emerick
f0660e33a2 add test for unicode multipart post 2013-04-01 18:10:12 -04:00
Thomas Weißschuh
333fa87489 fix tiny typo in HISTORY.rst 2013-04-01 18:47:20 +00:00
Pascal Borreli
037b38badb Fixed typos 2013-04-01 18:02:18 +00:00
Alex Gaynor
39acf1dbd2 is should not be used for comparing numbers 2013-03-31 23:20:46 -07:00
Kenneth Reitz
59b69d1fb8 Merge remote-tracking branch 'origin/master' 2013-03-31 08:28:57 +03:00
Kenneth Reitz
d06908d655 v1.2.0 2013-03-31 08:28:22 +03:00
Kenneth Reitz
5b5ffc9714 Merge pull request #1268 from t-8ch/update_urllib3
update vendored urllib3
2013-03-30 22:27:59 -07:00
Kenneth Reitz
75703d57e6 fix syntax error 2013-03-31 08:22:44 +03:00
Kenneth Reitz
bd6b981d12 Merge pull request #1267 from sigmavirus24/master
One last pull request before 1.2 ideally
2013-03-30 22:21:52 -07:00
Kenneth Reitz
6a2eea8b21 Merge pull request #1270 from makto/add_attr
add 'max_redirects' to Session's __attrs__
2013-03-30 22:20:02 -07:00
Ian Cordasco
325ea7b7e2 Use session defaults instead of arbitrary ones 2013-03-29 20:18:58 -04:00
makto
4ffae38627 add 'max_redirects' to Session's __attrs__ to ensure proper serialization of Session 2013-03-29 20:58:15 +08:00
Thomas Weißschuh
d7908a9fde update vendored urllib3 2013-03-28 12:49:04 +00:00
Ian Cordasco
0cd23d8d6e Fix the tests and unseparate comments from code
See the comments on the previous few commits on GitHub.
2013-03-28 08:33:34 -04:00
Ian Cordasco
aca91e06f2 Restore Session.request docstring
Resolves #1251
2013-03-27 23:46:21 -04:00
Ian Cordasco
88177ec33f Finally resolve #1084
Send body on redirect when POSTing or PUTing.
2013-03-27 23:30:00 -04:00
Ian Cordasco
1d5c4f3f0f This should take care of #1266
We were sending 'None' as the Content-Length on requests where the body was a
generator. This commit should prevent that entirely.
2013-03-27 23:26:11 -04:00
Ian Cordasco
478d49027f Add correct defaults in Session.send()
Resolves #1258

Also fixed the tests to reflect the necessary changes.
2013-03-27 23:17:34 -04:00
Ian Cordasco
46a770e03f Update the HISTORY for v1.2 2013-03-27 23:10:59 -04:00
Kenneth Reitz
ba25184ed5 sp 2013-03-26 16:38:11 -04:00
Kenneth Reitz
7f1ad5c127 Merge remote-tracking branch 'origin/master' 2013-03-26 16:32:25 -04:00
Kenneth Reitz
ab19b79375 Rezzy the Request Sea Turtle 2013-03-26 16:32:20 -04:00
Kenneth Reitz
c63472e328 Merge pull request #1263 from justin-factual/master
iter_lines documentation for #1260
2013-03-25 12:48:45 -07:00
Justin Fenn
6963b8490c Clarify streaming behavior in iter_lines doc 2013-03-25 12:20:33 -07:00
Ovidiu Negrut
9d16c72767 compiled regex expression in digest auth, this also works in python 2.6.x 2013-03-25 12:28:25 +02:00
Ovidiu Negrut
186a589783 Merge branch 'master' of git://github.com/kennethreitz/requests 2013-03-25 12:26:45 +02:00
Kenneth Reitz
12ef43e407 /s/make/invoke 2013-03-22 15:52:08 -04:00
Kenneth Reitz
92f7478174 first 2013-03-22 15:48:27 -04:00
Kenneth Reitz
19d38d502f actually cleanup url authentication 2013-03-22 15:47:20 -04:00
Kenneth Reitz
52d328ec3c cp949prover for charade 2013-03-22 15:21:28 -04:00
Kenneth Reitz
a554828931 invoke! 2013-03-22 15:21:04 -04:00
Kenneth Reitz
80a861cb84 upgrade to charade v1.0.3 2013-03-22 15:20:49 -04:00
Kenneth Reitz
0d07d1afb3 remove makefile 2013-03-22 15:20:27 -04:00
Kenneth Reitz
030b9763b5 fix get_auth_from_url 2013-03-22 00:15:06 -04:00
Kenneth Reitz
03a3ca5004 get_auth_from_url return None if nothing is found 2013-03-22 00:13:08 -04:00
Kenneth Reitz
1325409560 simplify get_auth_from_url call 2013-03-22 00:12:58 -04:00
Kenneth Reitz
13aeb9cb06 Merge pull request #1254 from jkakar/url-authentication
url-authentication
2013-03-21 21:06:23 -07:00
Jamu Kakar
7d217bf9bd - Pull credentials out of the URL when possible. 2013-03-21 17:55:08 -07:00
Kenneth Reitz
cb2116dcce Merge pull request #1239 from miikka/fix-issue-1228
Use session cookies when following redirects
2013-03-20 03:37:25 -07:00
Kenneth Reitz
db90d85a8d Merge pull request #1245 from Damgaard/master
Remove duplicate comment.
2013-03-14 08:29:53 -07:00
Andreas Damgaard Pedersen
af791d48c6 Remove duplicate comment. 2013-03-14 16:12:45 +01:00
Miikka Koskinen
120a2f385a Do not pass cookies to resolve_redirects
SessionRedirectMixin is extending Session, so we can just use
self.cookies.
2013-03-12 18:45:11 +02:00
Miikka Koskinen
5bb2be9a23 Use session cookies when following redirects
When a redirect was followed, only the cookies set by the initial
response were used in the follow-up request. Fixes #1228.
2013-03-12 18:43:58 +02:00
Miikka Koskinen
e958511df0 Add failing test case for #1228 2013-03-12 18:43:58 +02:00
Kenneth Reitz
1642996798 Merge pull request #1244 from jajadinimueter/master
Fixed further pickeling issues in Session and HTTPAdapter
2013-03-12 08:23:21 -07:00
Florian Mueller
c41932e184 Fixed some pickeling issues with HTTPAdapter and Session
Added trust_env and stream to Session.__attrs__. Initialize
self._pool_connections and self._pool_maxsize in HTTPAdapter.
2013-03-12 16:04:19 +01:00
Kenneth Reitz
25ea8cdb38 Merge pull request #1243 from darjus-amzn/master
Pickling of Session and HTTPAdapter + a test
2013-03-12 07:37:55 -07:00
Darjus Loktevic
e706d18cf8 Pickling of Session and HTTPAdapter + a test
This is for issue #1088
2013-03-11 18:12:34 +00:00
Ovidiu Negrut
e752455b6f Digest auth: case insensitive replacement of 'digest ' string with '' from WWW-Authenticate 2013-03-11 10:28:37 +02:00
Kenneth Reitz
3e72f234d0 Merge pull request #1238 from oczkers/master
cleanup (remove max_retries test)
2013-03-08 11:51:42 -08:00
Piotr Staroszczyk
25dc07e8ed cleanup (remove max_retries test) 2013-03-08 11:17:17 +01:00
Kenneth Reitz
13de69299f Merge pull request #1234 from Vassius/issue-1225
Fix issue #1225 (Documentation: response object status/reason)
2013-03-05 07:31:10 -08:00
Markus Wiik
90e109c241 Fix issue #1225 (Documentation: response object status/reason) 2013-03-05 16:18:24 +01:00
Kenneth Reitz
d25ba77b2e Merge remote-tracking branch 'origin/master' 2013-03-04 17:54:32 -05:00
Kenneth Reitz
c0d4b23cea Merge branch 'httperror_init' of git://github.com/dmedvinsky/requests
Conflicts:
	AUTHORS.rst
	test_requests.py
2013-03-04 17:54:25 -05:00
Kenneth Reitz
99eead01a3 Merge pull request #1223 from andrewjesaitis/master
Fixes __getstate__ for session pickling
2013-03-04 14:52:31 -08:00
Andrew Jesaitis
d60845303b Adds __attrs__ back to Session object 2013-03-04 11:07:29 -07:00
Kenneth Reitz
b14584f36e Revert "[kennethreitz/requests#1208] adding unit test for max_retries"
This reverts commit 18b29ea005.
2013-03-03 12:01:47 -05:00
Kenneth Reitz
23d8522285 Revert "[kennethreitz/requests#1208] adding a max_retries argument"
This reverts commit 796d3225dd.
2013-03-03 12:01:38 -05:00
Dmitry Medvinsky
c4f9340fb4 Add ability to pass response to HTTPError()
Just a little refactoring, but it seems nicer to me to be able to pass
the response when constructing the `HTTPError` instance instead of
constructing it and then changing the member variable.
2013-03-03 10:05:42 +04:00
Kenneth Reitz
d372a5b10b Merge pull request #1190 from mkomitee/master
Pass user options to hooks
2013-03-02 13:04:00 -08:00
Kenneth Reitz
7aad3fd08c Merge pull request #1219 from Wilfred/master
Adding max_retries as an argument
2013-03-02 13:02:26 -08:00
Kenneth Reitz
76c4b68e4a Merge pull request #1226 from dmedvinsky/fix-typos
Fix couple of typos in HISTORY.rst
2013-03-02 13:00:48 -08:00
Kenneth Reitz
07441c8951 Merge pull request #1229 from sprt/master
Doc fix: URLError doesn't exist anymore
2013-03-02 12:59:41 -08:00
Kenneth Reitz
98ff29f793 Merge pull request #1230 from davidfischer/trivial-docs-fix
Github URL fix
2013-03-02 12:59:10 -08:00
Kenneth Reitz
08cab48431 Merge pull request #1231 from davidfischer/docs-migration1.0
Initial docs patch for migrating from pre 1.0
2013-03-02 12:58:49 -08:00
David Fischer
7e7c275504 Session isn't advertised as a context manager 2013-03-02 08:59:19 -08:00
David Fischer
73abf84ace Capitalize s in Session 2013-03-02 08:51:55 -08:00
David Fischer
7eba5ffe48 Logic on streaming responses was changed in 1.0
* prefetch=False in 0.x is now stream=True
2013-03-02 08:44:14 -08:00
David Fischer
1d2ee524d8 Initial docs patch for migrating from pre 1.0 2013-03-01 23:21:08 -08:00
David Fischer
38f2581d6f Github URL fix 2013-03-01 20:36:42 -08:00
sprt
b80f8aa475 URLError doesn't exist anymore 2013-03-01 20:20:53 +01:00
Dmitry Medvinsky
057f32924a Fix couple of typos in HISTORY.rst
One typo and a couple of auto-completions, I guess.
2013-03-01 11:42:43 +04:00
Andrew Jesaitis
6a0845c984 Checks __attrs__ on session instance prior to iterating. 2013-02-28 15:13:57 -07:00
Wilfred Hughes
18b29ea005 [kennethreitz/requests#1208] adding unit test for max_retries 2013-02-27 16:01:36 +00:00
Wilfred Hughes
796d3225dd [kennethreitz/requests#1208] adding a max_retries argument 2013-02-27 16:01:23 +00:00
Ian Cordasco
be62645dd5 Revert "If Content-Length is already set.."[1]
This reverts commit 544d08d0f6.

[1]"If Content-Length is already set, don't over ride it"
2013-02-25 09:29:05 -05:00
Kenneth Reitz
603fd42fe6 Merge pull request #1205 from sigmavirus24/fix1203
Missing line was allowing redirects with HEAD
2013-02-25 02:31:21 -08:00
Kenneth Reitz
1fc567449c Merge pull request #1210 from Lukasa/urlencode_proxy
Unquote proxy usernames and passwords.
2013-02-25 02:31:00 -08:00
Kenneth Reitz
c01bc5be5b Revert "Lukasa is lazy"
This reverts commit 178ff62b93.
2013-02-22 08:23:34 -05:00
Cory Benfield
577dba2bf7 Unquote proxy usernames and passwords. 2013-02-22 11:33:01 +11:00
Ian Cordasco
a788cb7271 Missing line was allowing redirects with HEAD
Closes #1203
2013-02-20 08:57:37 -05:00
Kenneth Reitz
178ff62b93 Lukasa is lazy 2013-02-20 02:11:41 -05:00
Kenneth Reitz
aa99525537 Merge pull request #1193 from Lukasa/timeout_exception
Throw more informative exceptions.
2013-02-19 23:10:44 -08:00
Kenneth Reitz
7e0b9cf409 Merge pull request #1200 from gazpachoking/session_cookies_fix
Make sure session cookies do not overwrite explicit request cookies
2013-02-19 22:50:10 -08:00
Kenneth Reitz
017c027629 Merge pull request #1199 from t-8ch/docs_explicit_proxy_scheme
Use explicit scheme for proxies in the docs
2013-02-19 05:40:15 -08:00
Cory Benfield
c2480f65e6 Rethrow underlying exceptions. 2013-02-18 16:30:16 +11:00
Chase Sterling
3f86e22a07 Make sure session cookies do not overwrite explicit request cookies
Implement RequestsCookieJar.copy
Use RequestsCookieJar.update when merging cookiejars
2013-02-16 00:56:59 -05:00
Thomas Weißschuh
b53975327f use explicit scheme for proxies in the docs
Issue #1192 tried to force user to provide a scheme for proxy urls.
As this would break backwards compability change the docs instead.
2013-02-15 16:32:50 +00:00
Kenneth Reitz
d0390d4f27 Merge pull request #1194 from gazpachoking/cookiejar_update
Allow RequestsCookieJar to be updated with cookies from a CookieJar
2013-02-14 22:42:49 -08:00
Chase Sterling
f3393fb24c Remove ability to from RequestCookieJar __getitem__, __setitem__ to use cookies as keys 2013-02-14 22:52:31 -05:00
Michael Komitee
4c21106222 Fixing test for python3 2013-02-14 21:33:01 -05:00
Chase Sterling
87d9d9643c Allow RequestsCookieJar to be updated with cookies from a CookieJar 2013-02-14 01:05:42 -05:00
Michael Komitee
df5dcb8a7d New tests fail on python 3.x because read() returns bytes and the test checks for strings 2013-02-13 22:42:56 -05:00
Michael Komitee
69ba64380b Adding test to ensure options like stream function with authentication
This test demonstrates the reason why we need to pass kwargs to hooks. Without
it, features like stream cannot work with authentication.
2013-02-13 21:28:32 -05:00
Michael Komitee
d0285fac42 Use user supplied options when resending authenticated requests
Hooks sometimes have to send requests (e.g. when responding to a 401 during
authentication).

All keyword arguments should be passed along when hooks are dispatched so that
if a user wanted to use a timeout, stream, specify a cert location with the
verify flag, etc, their specification can be followed.
2013-02-13 19:11:38 -05:00
Kenneth Reitz
f73bda06e9 Merge pull request #1185 from sigmavirus24/fix_hook_dispatching
Dispatch hooks before following redirects
2013-02-13 02:13:31 -08:00
Ian Cordasco
4dfd6f3fc1 Dispatch hooks before following redirects
Fixes #1183
2013-02-12 23:00:06 -05:00
Kenneth Reitz
cdec20af65 Merge pull request #1181 from denis-ryzhkov/master
Fix of UnicodeDecodeError on unicode header name that can be converted to ascii.
2013-02-12 08:43:02 -08:00
Kenneth Reitz
09a7251245 Merge pull request #1184 from piotr-dobrogost/numeric_codes
small cleanup of redirect codes
2013-02-12 00:27:05 -08:00
Denis Ryzhkov
56f4b7ca68 Deleted is_py2 check from unicode_header_name fix thanks to Lukasa. 2013-02-12 09:51:46 +03:00
Piotr Dobrogost
4c8d1b9a7d removed no longer used redirect codes from models
added numeric values of redirect codes in comments
2013-02-11 23:07:12 +01:00
Denis Ryzhkov
6da7e22a4a Fix of UnicodeDecodeError on unicode header name that can be converted to ascii. 2013-02-11 15:37:58 +03:00
Kenneth Reitz
5d9fcc711b Merge pull request #1180 from sigmavirus24/master
Fix Session level Cookie Handling
2013-02-10 16:43:21 -08:00
Ian Cordasco
2e31696156 Test and perfection for cookie handling.
I also fixed up some of the RequestsCookieJar methods so using
jar.update(other_jar) works without a problem. This cleans up some of the code
in sessions and the resolve_redirects method.
2013-02-10 19:36:36 -05:00
Ian Cordasco
0fb13e0b6c And tests 2013-02-10 17:49:49 -05:00
Kenneth Reitz
1da1490bcd urllib3 update
#1053
2013-02-10 17:43:58 -05:00
Ian Cordasco
9cdc8325ae Fix Setting a cookie on redirect 2013-02-10 17:43:37 -05:00
Kenneth Reitz
12d66cfc41 Merge pull request #1173 from sigmavirus24/use_send_in_resolve_redirects
Use send in resolve redirects
2013-02-10 14:21:13 -08:00
Ian Cordasco
9c8660dbb6 Resolve @piotr-dobrogost's concerns
Piotr had good objections to my not re-sending the body of the request on 307.
2013-02-10 17:14:45 -05:00
Ian Cordasco
e7bc9bf1b2 Preserve the original request.
Let's make a copy to preserve it.
2013-02-10 17:11:16 -05:00
Ian Cordasco
e2ad0d0fe8 We shouldn't be sending the data on redirect.
As such, we should remove the body from the old request as well as the
Content-Length header.
2013-02-10 17:11:16 -05:00
Ian Cordasco
3299771e34 Fix the potential issue mentioned in #1151
See: https://github.com/kennethreitz/requests/pull/1151#issuecomment-12905796

This is solved by just reusing the PreparedRequest from the last request.
2013-02-10 17:11:16 -05:00
Kenneth Reitz
f2be5fae27 Merge pull request #1161 from sigmavirus24/fix1159
If Content-Length is already set, don't override
2013-02-10 14:07:08 -08:00
Kenneth Reitz
90cd37fda0 Merge pull request #1119 from Lukasa/diags
Better diagnostics when trying to send unprepared request
2013-02-10 14:06:38 -08:00
Cory Benfield
b0657cf163 Guard against users sending unprepared requests. 2013-02-10 06:13:02 +00:00
Kenneth Reitz
03f6908fe9 Merge pull request #1162 from Lukasa/proxy_auth
Proxy Authorization Headers
2013-02-06 13:05:04 -08:00
Kenneth Reitz
c68f928254 Merge pull request #1168 from Lukasa/freeze
Feature freeze.
2013-02-06 11:53:55 -08:00
Cory Benfield
ff954e16f1 Feature freeze. 2013-02-06 19:01:24 +00:00
Cory Benfield
d437c338d0 Add Proxy-Auth header when proxies have credentials. 2013-02-06 18:40:35 +00:00
Kenneth Reitz
9fc7059140 Merge pull request #1151 from sigmavirus24/fix1133
Move redirect handling from Session.request to Session.send
2013-02-05 11:42:51 -08:00
Ian Cordasco
544d08d0f6 If Content-Length is already set, don't override
Re: #1159
2013-02-01 11:58:23 -05:00
Kenneth Reitz
ae55676a50 Merge pull request #1158 from yehudasa/master
Fix check that breaks handling of 303 response in some cases (v2)
2013-02-01 07:30:47 -08:00
Yehuda Sadeh
b07c1ebd85 Fix POST 303 redirect resonse handling
This fixes issue #1156.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2013-01-31 11:23:09 -08:00
Kenneth Reitz
113b67c069 moar 2013-01-31 14:35:42 +00:00
Kenneth Reitz
12246afab8 HMG 2013-01-31 13:20:14 +00:00
Kenneth Reitz
85da715f40 Merge pull request #1153 from cbare/master
use only base filename in multipart file upload
2013-01-30 15:56:21 -08:00
Kenneth Reitz
b554b0c1cb Merge pull request #1152 from ekatsah/patch-1
Update docs/user/advanced.rst
2013-01-30 15:54:20 -08:00
Christopher Bare
9ff8cbe5fb shorten filename by os.path.basename in guess_filename(obj) 2013-01-30 15:33:43 -08:00
ekatsah
79727abb32 Update docs/user/advanced.rst
Rephrasing a line in the docs, add explicite mention of "client side certificate" (for indexing and clarity)
2013-01-30 21:22:24 +01:00
Ian Cordasco
ba485913b6 Thanks to @maxcountryman for the code review 2013-01-30 10:58:32 -05:00
Ian Cordasco
a95bfd3032 Fix the elapsed test and #1133 2013-01-29 23:50:37 -05:00
Kenneth Reitz
207a2744aa Merge pull request #1143 from Lukasa/master
Response as iterator
2013-01-28 20:52:17 -08:00
Cory Benfield
95084c9ca8 Fix test for Py3. 2013-01-28 18:35:41 +00:00
Cory Benfield
2f7923bc05 More useful docstring. 2013-01-28 18:35:41 +00:00
Cory Benfield
2ac3913733 Make Response objects iterable. 2013-01-28 18:35:41 +00:00
Kenneth Reitz
231e343a3b Merge pull request #1148 from sigmavirus24/timing_switch
Move the timing work to Session.send
2013-01-28 09:40:10 -08:00
Ian Cordasco
c8ad4f0b73 Move the timing work to Session.send
per @kennethreitz's request
2013-01-28 11:53:02 -05:00
Kenneth Reitz
25545b393b Merge pull request #1146 from oczkers/master
It`s more pep8 now
2013-01-27 19:11:15 -08:00
Kenneth Reitz
dfa89e299a Merge pull request #1138 from clee/master
Time each request
2013-01-27 19:10:16 -08:00
Chris Lee
318300848f Use timedelta and change attribute name back to elapsed 2013-01-27 19:07:48 -08:00
Chris Lee
d4aaef1e9a Time how long each request takes
Stored as attribute Response.time_taken
2013-01-27 19:06:50 -08:00
oczkers
40a060cf57 it`s more pep8 now 2013-01-27 02:04:12 +01:00
Kenneth Reitz
ac5e6807fa Merge pull request #1145 from sigmavirus24/master
Mock the links test
2013-01-26 09:05:19 -08:00
Ian Cordasco
250896b7f3 Mock the links test. 2013-01-26 11:55:08 -05:00
Kenneth Reitz
9d1d927420 Merge pull request #1103 from dmckeone/master
Restore the ability to use a list of 2-tuples for the data keyword argument with requests.post.
2013-01-25 21:02:01 -08:00
Kenneth Reitz
440aeca5d4 Merge pull request #1123 from andrewjesaitis/master
Fixes DigestAuth with Sessions
2013-01-25 21:00:33 -08:00
Kenneth Reitz
b6af86225d Merge pull request #1140 from ralphbean/cookie-test
Test for cookie parameters.
2013-01-25 20:58:35 -08:00
Kenneth Reitz
c50f8f7cc8 Merge pull request #1142 from theaeolianmachine/removeGETContentLength
Remove default Content-Length from GET requests.
2013-01-25 20:58:20 -08:00
Johnny Goodnow
8d8865aadb Remove Content-Length from GET/HEAD by default.
Now, Content-Length is only auto-added for non-GET/HEAD requests.
2013-01-25 20:50:58 -08:00
Johnny Goodnow
f7c10ca74d Always add Content-Length to HTTP PATCH. 2013-01-25 12:07:24 -08:00
Johnny Goodnow
4cac9f07c4 Add myself to AUTHORS. 2013-01-25 00:19:09 -08:00
Johnny Goodnow
f453892960 Fix python 2.6 unittest compatability issue. 2013-01-24 21:25:14 -08:00
Johnny Goodnow
44b1e7ebea Remove default Content-Length from GET requests.
Fix #1051.
2013-01-24 21:13:32 -08:00
Ralph Bean
4ce6440795 purported py2.6 support for cookies test. 2013-01-25 00:10:51 -05:00
Kenneth Reitz
22623bd8c2 Merge pull request #1099 from sprt/master
Make hooks work with prepared requests
2013-01-24 10:00:24 -08:00
Ralph Bean
5861254d8f Test for cookie parameters. 2013-01-24 12:47:55 -05:00
sprt
ab2e7df8a9 Merge branch 'master' of git://github.com/kennethreitz/requests
Conflicts:
	test_requests.py
2013-01-24 18:36:53 +01:00
Kenneth Reitz
beec48c8f8 Merge pull request #1137 from whit537/unperson_test
Remove a test per @kennethreitz in IRC
2013-01-23 17:37:13 -08:00
Kenneth Reitz
b2427223c1 Merge pull request #1136 from steveklabnik/test_link_header
introduce a test for link headers.
2013-01-23 17:34:55 -08:00
Chad Whitacre
ef52044c5f Remove a test per @kennethreitz in IRC
The test suite is moving from the httpbin pattern (which hits the
network) to depending on the request.prepare method (which doesn't).
Here's a start ...
2013-01-23 20:32:03 -05:00
Steve Klabnik
ccea28db07 introduce a test for link headers. 2013-01-23 20:31:05 -05:00
Kenneth Reitz
e21ef547f7 Merge pull request #1134 from steveklabnik/remove_silly_assert
remove silly assert
2013-01-23 17:06:40 -08:00
Steve Klabnik
0af8ff9405 remove silly assert 2013-01-23 20:03:43 -05:00
Kenneth Reitz
6e0ca583fe Merge pull request #1132 from sburns/jsonkwargs
Pass kwargs to json.loads
2013-01-23 14:02:37 -08:00
Scott Burns
2bcc4a774a Pass kwargs to json.loads
Not all JSON is created equally. This commit
addresses when users want to take control of the
json decode process.
2013-01-23 15:25:48 -06:00
Andrew Jesaitis
34268b16c3 Moves num_401_calls counter to HTTPDigestAuth 2013-01-23 10:32:56 -07:00
Ian Cordasco
1cfe59299b Only call the hook once. 2013-01-23 11:51:37 -05:00
Ian Cordasco
e771aa9386 Comment & replace something that keeps disappearing 2013-01-23 11:28:30 -05:00
sprt
cc7bee19f0 Refactor prepare_hooks() 2013-01-23 15:45:44 +01:00
sprt
088f908d58 Add missing import 2013-01-23 15:45:14 +01:00
sprt
c4ad8afba9 Merge remote-tracking branch 'upstream/master'
Conflicts:
	requests/sessions.py
2013-01-23 14:42:45 +01:00
Kenneth Reitz
0c09d16b29 Merge pull request #1125 from juanriaza/master
HTTPDigestAuth: missing algorithm field
2013-01-22 19:43:50 -08:00
Kenneth Reitz
30573b2d8b Merge pull request #1116 from Lukasa/master
Correct type of Content-Length headers.
2013-01-22 18:51:17 -08:00
Kenneth Reitz
1a87f15e6f Merge pull request #1117 from sigmavirus24/issue1106
Fix #1106
2013-01-22 18:48:31 -08:00
Kenneth Reitz
472a5b4748 Merge pull request #1127 from sigmavirus24/fix1126
A simple fix
2013-01-22 17:53:16 -08:00
Kenneth Reitz
b94510fc42 Merge pull request #1128 from mvid/master
Updating urllib3 to current master
2013-01-22 17:45:00 -08:00
Mantas Vidutis
6e53290acd update urllib3 to current master with ssl bugfixes 2013-01-22 14:40:10 -08:00
Ian Cordasco
ca85b4ec6c Tests pass this time. 2013-01-22 17:22:12 -05:00
Juan Riaza
a6360ca134 missing algorithm field 2013-01-22 16:35:16 +01:00
Kenneth Reitz
47aa968f3c Merge pull request #1121 from Lukasa/typo
Small typo fixes.
2013-01-22 06:40:24 -08:00
Kenneth Reitz
3bf46609c8 Merge pull request #1097 from matthewlmcclure/issues/1096
Resolves the parts of #1096 in requests proper.
2013-01-22 05:11:14 -08:00
Kenneth Reitz
cd0cbada65 Merge pull request #1095 from Jud/patch-1
Fix spacing in setup.py
2013-01-22 05:10:19 -08:00
Kenneth Reitz
ed559bb8b1 Merge pull request #1122 from Lukasa/readline
Decrease default line length for iter_lines
2013-01-22 05:09:11 -08:00
Ian Cordasco
27e814ad76 Fix failing tests. 2013-01-21 20:21:08 -05:00
Andrew Jesaitis
03893d9b7f Fixes repeated 401s when using DigestAuth with a session 2013-01-21 16:34:11 -07:00
Cory Benfield
297aa04bea Decrease default line length for iter_lines 2013-01-21 21:15:04 +00:00
Cory Benfield
c678a7b402 Small typo fixes. 2013-01-21 19:55:08 +00:00
Kenneth Reitz
b7242a1ad1 Merge pull request #1120 from spulec/patch-2
Add py3.3 testing back
2013-01-21 11:27:41 -08:00
Steve Pulec
cf0a5089f5 Add py3.3 testing back 2013-01-21 14:19:29 -05:00
Cory Benfield
de32f1774f Remove test that cannot work on Python3. 2013-01-19 17:14:32 +00:00
Ian Cordasco
e1c4fe21d4 Fix #1106 2013-01-19 11:49:52 -05:00
Cory Benfield
89c8cbbe0c Ensure Content-Length is a string. 2013-01-19 12:07:34 +00:00
Kenneth Reitz
16ba63ccde Merge pull request #1114 from vlaci/master
Keep-alive support for http proxies
2013-01-18 05:40:26 -08:00
László Vaskó
347a52aa5c Fixed proxy requests to pool connections. 2013-01-18 13:41:14 +01:00
Kenneth Reitz
c920ee57b8 Merge pull request #1110 from slingamn/certifi_eol
Remove support for certifi
2013-01-18 04:39:41 -08:00
Shivaram Lingamneni
985a906c6c Remove support for certifi
As per #1105, certifi is being end-of-lifed. Requests will use either
its own vendored bundle, or possibly (when packaged with OS distributions)
an externally packaged bundle, which can be enabled by patching
requests.certs.where().
2013-01-17 20:44:01 -08:00
Kenneth Reitz
f038f68ad8 Merge pull request #1107 from Lukasa/master
Correct broken cookies example
2013-01-17 19:50:55 -08:00
Cory Benfield
d3e6597f73 Update docs with correct cookie behaviour. 2013-01-17 19:28:28 +00:00
Kenneth Reitz
f8d729a17b Merge pull request #1105 from slingamn/turktrust
refresh CA certificates
2013-01-17 02:51:52 -08:00
Shivaram Lingamneni
b66427eab9 remove the TURKTRUST root certificates, as per #1102 2013-01-17 02:02:49 -08:00
David McKeone
35d4a47cb1 Allow passing POST data with a list of 2-tuples. 2013-01-16 11:53:24 -07:00
sprt
a721d590b4 Make hooks work with prepared requests 2013-01-12 21:46:44 +01:00
Matt McClure
628e393b9a Resolves the parts of #1096 in requests proper. 2013-01-11 15:04:47 -05:00
Jud
a950322b07 Fix spacing in setup.py 2013-01-11 11:42:02 -05:00
Kenneth Reitz
34917618d8 +1 2013-01-11 09:34:14 -05:00
Kenneth Reitz
1a7c91f658 Merge remote-tracking branch 'origin/master' 2013-01-10 02:13:06 -05:00
Kenneth Reitz
41687c8fa8 v1.1.0 and docs 2013-01-10 02:13:02 -05:00
Kenneth Reitz
91f6e69cc4 Merge pull request #1092 from jianlius/case-insensitive-update
Make merge_kwargs case-insensitive when looking up keys.
2013-01-09 23:07:45 -08:00
Kenneth Reitz
6ec1a9ca52 Merge pull request #1091 from vinodc/specify_file_content_type
Allow for explicit file content type support
2013-01-09 23:02:47 -08:00
Kenneth Reitz
9d33629b6d don't supply params for directs
Closes #1070
2013-01-10 01:58:46 -05:00
Kenneth Reitz
ef8563ab36 CHUNKED REQUESTS! 2013-01-10 01:58:29 -05:00
Jian Li
a392a87389 Retrieve kwargs.keys() just once. 2013-01-09 22:07:38 -08:00
Kenneth Reitz
4a5b5bc86e test cleanup 2013-01-10 00:40:17 -05:00
Jian Li
68edcd12b1 Make merge_kwargs case-insensitive when looking up keys. 2013-01-09 21:29:24 -08:00
Vinod Chandru
fbc366c1a5 Fixing test to ensure it passes with python 3. 2013-01-09 20:10:54 -08:00
Vinod Chandru
20b10aed1b Allow for third argument in file dict value to support explicit
file content type.
2013-01-09 19:29:28 -08:00
Kenneth Reitz
b4505284f2 Merge pull request #1080 from sigmavirus24/master
Fix #1079
2013-01-07 10:42:30 -08:00
Kenneth Reitz
47fe258b5a Merge pull request #1085 from graingert/patch-1
Update the advanced doc to use the r.json method
2013-01-07 10:42:14 -08:00
Kenneth Reitz
21616a815b Merge pull request #1086 from graingert/patch-2
Update the link headers doc to match the code
2013-01-07 10:41:51 -08:00
Kenneth Reitz
50934e056e Merge pull request #1089 from PaulMcMillan/philosophy
Clarify support for alternative distributions
2013-01-07 10:41:32 -08:00
Paul McMillan
ba1df2cfca Clarify support for alternative distributions 2013-01-07 13:34:51 -05:00
Thomas Grainger
7dc13e5cab Update the link headers doc to match the code 2013-01-04 21:46:14 +00:00
Thomas Grainger
7687746c7c Update the advanced doc to use the r.json method 2013-01-04 21:33:51 +00:00
Ian Cordasco
5264c71d86 Fix #1079
Restore the functionality from here:
https://github.com/kennethreitz/requests/blob/v0.14.2/requests/models.py#L884
2013-01-02 14:25:33 -05:00
Kenneth Reitz
5d87e1aeba Update LICENSE 2012-12-31 17:59:18 -05:00
Kenneth Reitz
c03e893416 Merge pull request #1076 from sigmavirus24/master
Remove (safe|danger)_mode references from docs
2012-12-30 23:49:44 -08:00
Ian Cordasco
fef09a6691 Remove safe_mode/danger_mode from docs 2012-12-30 19:46:04 -05:00
Kenneth Reitz
1d35d439cc Merge pull request #1071 from Lukasa/master
Proxies should have schemes.
2012-12-28 07:41:55 -08:00
Cory Benfield
054e1ab3ee Remove silly print statement. 2012-12-28 15:38:04 +00:00
Cory Benfield
641f4611b2 Make sure proxies have their scheme attached. 2012-12-27 13:37:36 +00:00
Kenneth Reitz
594716abea Merge pull request #1060 from Lukasa/proxy
Provide full URL to proxies.
2012-12-27 03:24:55 -08:00
Cory Benfield
d675abbd3f Remove unneeded import. 2012-12-27 11:22:36 +00:00
Cory Benfield
702f4039bc Use full URL when contacting proxies.
Requests should use the full URL, not the path URL, when forwarding
traffic through proxies.
2012-12-27 11:22:36 +00:00
Cory Benfield
b479a62ec2 PreparedRequests don't carry proxy information.
The proxy info appears to be carried on the session. The only remnants
of proxy handling are this line in __init__().
2012-12-27 11:22:36 +00:00
Kenneth Reitz
81c18c70f5 Merge pull request #1065 from slingamn/certs.release
clean up code support for OS certificate bundles
2012-12-23 02:49:02 -08:00
Shivaram Lingamneni
bbea679ab2 clean up code support for OS certificate bundles 2012-12-23 02:40:18 -08:00
Kenneth Reitz
f1d51aa7eb timeout 2012-12-23 02:45:41 -05:00
Kenneth Reitz
5b5ff69201 update docs 2012-12-23 02:42:14 -05:00
Kenneth Reitz
0665129008 reorder out there 2012-12-23 02:34:53 -05:00
Kenneth Reitz
afd6482219 python for ios 2012-12-23 02:33:03 -05:00
Kenneth Reitz
a23f22e5dc support 2012-12-23 02:29:24 -05:00
Kenneth Reitz
e00e50d01a philsophy 2012-12-23 02:27:28 -05:00
Kenneth Reitz
1960c3c29d Benevolent 2012-12-23 02:25:59 -05:00
Kenneth Reitz
08f66a99b1 semantic versioning 2012-12-23 02:13:31 -05:00
Kenneth Reitz
ab64052642 developer values 2012-12-23 02:07:01 -05:00
Kenneth Reitz
25a9c9fb22 - Python 2.6—3.3 2012-12-23 01:56:46 -05:00
Kenneth Reitz
f0beed8686 + 2012-12-23 01:53:22 -05:00
Kenneth Reitz
5a7d461230 philosophy 2012-12-23 01:51:23 -05:00
Kenneth Reitz
d45eb53bc7 contributor 2012-12-23 01:50:52 -05:00
Kenneth Reitz
911e8aec8d developer interface 2012-12-23 01:50:23 -05:00
Kenneth Reitz
9f89ebe0de request sessions 2012-12-23 01:49:44 -05:00
Kenneth Reitz
526a0befc7 cleaup api docs 2012-12-23 01:47:35 -05:00
Kenneth Reitz
f0fe551dc9 thanks, @sigmavirus24 2012-12-23 01:45:49 -05:00
Kenneth Reitz
f8e2d0e732 api docs 2012-12-23 01:44:54 -05:00
Kenneth Reitz
fcccc82282 Merge remote-tracking branch 'origin/master' 2012-12-23 01:40:12 -05:00
Kenneth Reitz
3ddcc99131 docs update 2012-12-23 01:40:07 -05:00
Kenneth Reitz
70faca2a14 docs, cleanup for preparedrequest 2012-12-23 01:25:01 -05:00
Kenneth Reitz
5f9fecd3aa prepared request docs 2012-12-23 01:21:02 -05:00
Kenneth Reitz
6e780fad6d remove unused timeout 2012-12-23 01:16:00 -05:00
Kenneth Reitz
28b706da83 v1.0.4 2012-12-23 01:15:14 -05:00
Kenneth Reitz
aa3347b2a3 request 2012-12-23 01:14:27 -05:00
Kenneth Reitz
f8a59c3e6f request docstrings 2012-12-23 01:14:22 -05:00
Kenneth Reitz
484916066a Merge pull request #1064 from rascalking/master
fix POST redirects
2012-12-22 22:06:12 -08:00
Kenneth Reitz
b3fbc810d2 no async anymore 2012-12-23 01:02:32 -05:00
Kenneth Reitz
1539d17366 update test docs 2012-12-23 01:02:26 -05:00
Kenneth Reitz
a158abfa15 remove stuidly annoying email notifications 2012-12-23 00:52:18 -05:00
David Bonner
7d085b188c fix POST redirects
the redirect handling logic compares then method to upper-case strings,
so make sure the method gets upper-cased as well.

add a test to POST to /status/302 on httpbin, which fails against httpbin.org
right now.  i'm submitting a pull request over there to fix that right after
this one.  once that's accepted, the new test verifies that the fix works.
2012-12-23 00:51:26 -05:00
Kenneth Reitz
aaa3bf16a9 Merge pull request #1061 from philfreo/patch-1
Fixes url to AUTHORS.rst
2012-12-22 14:10:30 -08:00
Kenneth Reitz
22a1f0917b Merge pull request #1062 from philfreo/patch-2
Using 'master' branch for development
2012-12-22 14:10:17 -08:00
Phil Freo
78f48aef8f Using 'master' branch for development
I'm assuming you're no longer using a 'develop' branch, as I don't see one on GitHub.
2012-12-22 16:46:05 -05:00
Phil Freo
7b1b9df423 Fixes url to AUTHORS.rst
and also mention using 'master' as development branch now.
2012-12-22 16:44:43 -05:00
Kenneth Reitz
e23343ab17 Merge pull request #1059 from Lukasa/sess_docs
Update session documentation.
2012-12-22 03:08:47 -08:00
Kenneth Reitz
b8affd9520 Merge pull request #1049 from Lukasa/master
Correctly identify certificate filenames.
2012-12-22 03:05:50 -08:00
Cory Benfield
1790b1df17 Update session documentation. 2012-12-22 11:03:29 +00:00
Kenneth Reitz
60b4843678 Merge pull request #1055 from michaelwheeler/patch-1
Fixed typo in comment.
2012-12-20 12:55:51 -08:00
michaelwheeler
0b42772663 Fixed typo in comment. 2012-12-20 15:38:04 -05:00
Kenneth Reitz
a49db50b4a Merge pull request #1052 from hozn/apidocs-tweak
Small tweak to API docs to indicate that file-like object supported for data param.
2012-12-20 09:09:24 -08:00
Hans Lellelid
bfef8d99c8 Updated API docs for 'data' param in sessions module to indicate that file-like object is also supported. 2012-12-20 09:47:29 -05:00
Hans Lellelid
dd271782e8 Tweaked the 'data' param docs to indicate that a file-like object is also supported. 2012-12-20 09:45:06 -05:00
Cory Benfield
09da1921ff Import basestring. 2012-12-19 21:37:47 +00:00
Kenneth Reitz
0769ee3b6d Merge pull request #1048 from ib-lundgren/master
Swap prepare_auth and body
2012-12-19 13:12:03 -08:00
Ib Lundgren
05de270d7a Why auth must be prepared last 2012-12-19 21:30:11 +01:00
Cory Benfield
f1ba27faa2 Fix stupid, stupid logic error. 2012-12-19 20:26:41 +00:00
Cory Benfield
8cb904b49d Correctly identify cert files.
Resolves issue #1046.
2012-12-19 20:11:17 +00:00
Ib Lundgren
7e594eb121 Swap prepare_auth and prepare_body 2012-12-19 21:04:50 +01:00
Kenneth Reitz
4966d9c714 Merge pull request #1037 from sigmavirus24/master
Fix #1036
2012-12-18 10:09:33 -08:00
Ian Cordasco
14da5cf180 A possible fix for #1036
I can only assume that the only possible thing to close on a session are the
adapters. As such, I wrote the close method for a session object which closes
all possible adapters.
2012-12-18 09:43:55 -05:00
Kenneth Reitz
6acce57271 no kwargs 2012-12-18 05:01:32 -05:00
Kenneth Reitz
c60b72e2d0 v1.0.3 2012-12-18 04:50:41 -05:00
Kenneth Reitz
b2d03ac9a2 Merge pull request #1026 from TorKlingberg/master
Added requirements.txt to MANIFEST.in
2012-12-17 21:49:45 -08:00
Kenneth Reitz
027fbd3d51 Merge pull request #1030 from bboe/cookie_fix
Fix issue 1027. Always persist cookies.
2012-12-17 21:45:49 -08:00
Kenneth Reitz
a2f773a9fc Merge pull request #1031 from sigmavirus24/master
Just a bit of linting
2012-12-17 21:44:56 -08:00
Ian Cordasco
68d394952a A bit of linting.
Mostly removed a whole bunch of unused imports.
2012-12-17 20:19:11 -05:00
Bryce Boe
e355d6ac6c Fix issue 1027. Always persist cookies. 2012-12-17 17:13:18 -08:00
Apoc2400
dc74223461 MANIFEST.in contained test_requests.py but was missing requirements.txt that it depends on.
Added requirements.txt.
Now both files will be included in the .tar.gz file that can be downloaded from http://pypi.python.org/pypi/requests
2012-12-18 00:16:29 +01:00
Kenneth Reitz
5c4aa0bcb7 Merge pull request #1024 from etscrivner/master
Fix HTTP method encoding problem with attached files
2012-12-17 12:53:22 -08:00
Eric Scrivner
8c01865d62 Remove unicode encoding for HTTP method. 2012-12-17 12:39:15 -08:00
Eric Scrivner
916e6fcd64 Add unit-test to reproduce encoding error. 2012-12-17 12:28:08 -08:00
Kenneth Reitz
4701243199 Merge pull request #1009 from Lukasa/master
Auth documentation.
2012-12-17 11:27:36 -08:00
Cory Benfield
a7c5d5e8ac Split authentication out into a separate file. 2012-12-17 19:25:21 +00:00
Kenneth Reitz
d0f23820b5 Merge pull request #1022 from kisielk/master
JSON-related doc fixes
2012-12-17 11:03:40 -08:00
Kamil Kisiel
fe0b0a989f Fixed a few spots in the docs that were still using json as a property. 2012-12-17 11:02:06 -08:00
Kenneth Reitz
f549efd43d v1.0.2 2012-12-17 13:58:33 -05:00
Kenneth Reitz
5eb3a17b55 v1.0.2 2012-12-17 13:58:07 -05:00
Kenneth Reitz
b30b09e84c v1.0.1 2012-12-17 13:53:24 -05:00
Kenneth Reitz
5152c98223 fix for #1017 2012-12-17 13:52:46 -05:00
Kenneth Reitz
27c6dc3735 Merge pull request #1020 from Lukasa/misc
Fix off-by-one error.
2012-12-17 10:46:09 -08:00
Cory Benfield
8b1b706903 Fix off-by-one error. 2012-12-17 18:42:32 +00:00
Kenneth Reitz
64eee1eba7 v1.0.1 2012-12-17 13:42:03 -05:00
Kenneth Reitz
1e64fbcb55 CURL_CA_BUNDLE 2012-12-17 13:41:20 -05:00
Kenneth Reitz
910b2312d6 fix verify bug
Fixes #1019
2012-12-17 13:38:38 -05:00
Cory Benfield
54b77afbb5 Uh, typo broke the link. Yeah. That happened. 2012-12-17 18:31:56 +00:00
Cory Benfield
be364e13d3 Update auth documentation with org info. 2012-12-17 18:31:56 +00:00
Kenneth Reitz
9bb332fee1 remove .env 2012-12-17 12:55:40 -05:00
Kenneth Reitz
31c73a61f9 testimonial 2012-12-17 10:26:11 -05:00
Kenneth Reitz
0d8d99de66 travis on 3.3 is broken 2012-12-17 10:07:13 -05:00
Kenneth Reitz
88b5ebceb6 no 3.0 2012-12-17 09:59:05 -05:00
Kenneth Reitz
4c647cd8b7 0x01000 2012-12-17 09:57:48 -05:00
Kenneth Reitz
b95ad3f6a8 ready. 2012-12-17 09:57:13 -05:00
Kenneth Reitz
957216d1fb makin' history 2012-12-17 08:46:50 -05:00
Kenneth Reitz
92209d9ebe 3.3 2012-12-17 08:42:47 -05:00
Kenneth Reitz
c2100c0a4e requirements.txt 2012-12-17 08:39:13 -05:00
Kenneth Reitz
c65a52a1d0 update 2012-12-17 08:36:58 -05:00
Kenneth Reitz
1451ba0c6d update docs 2012-12-17 08:33:18 -05:00
Kenneth Reitz
480a3821ab remove chardet 2012-12-17 08:17:19 -05:00
Kenneth Reitz
0569fe44d8 new tests! 2012-12-17 08:09:52 -05:00
Kenneth Reitz
73ed0d01f6 basic tests 2012-12-17 07:39:27 -05:00
Kenneth Reitz
82cce02120 basic test 2012-12-17 07:29:33 -05:00
Kenneth Reitz
e4c4c80b82 remove all old tests 2012-12-17 07:27:25 -05:00
Kenneth Reitz
a982b0d903 proxy manager 2012-12-17 07:21:10 -05:00
Kenneth Reitz
c3431bb6f2 tension 2012-12-17 07:01:59 -05:00
Kenneth Reitz
d11522b29e Connection Adapter Mounting! 2012-12-17 06:55:33 -05:00
Kenneth Reitz
bc34f33955 apparent_encoding 2012-12-17 06:35:10 -05:00
Kenneth Reitz
4c3b9df609 /s/prefetch/stream 2012-12-17 06:35:01 -05:00
Kenneth Reitz
5b5d8a81b7 remove bunk 2012-12-17 06:26:22 -05:00
Kenneth Reitz
bc4af7c7e1 docstrings 2012-12-17 06:25:47 -05:00
Kenneth Reitz
ca0d08eeda urlparse(url) 2012-12-17 06:25:03 -05:00
Kenneth Reitz
a197309e21 generator rejection 2012-12-17 06:02:01 -05:00
Kenneth Reitz
a75ba04eed return_response 2012-12-17 05:59:17 -05:00
Kenneth Reitz
899c9a9522 fix cookies 2012-12-17 05:49:25 -05:00
Kenneth Reitz
42b0295521 __attrs__ 2012-12-17 05:48:18 -05:00
Kenneth Reitz
4bad1285b6 nice and cleanup 2012-12-17 05:47:41 -05:00
Kenneth Reitz
a776e7cb3e fix params support 2012-12-17 05:23:22 -05:00
Kenneth Reitz
def20cdb0c remove iter_json, don't want to commit to it 2012-12-17 05:12:59 -05:00
Kenneth Reitz
92355ada54 cleanup 2012-12-17 05:09:44 -05:00
Kenneth Reitz
42ee255c80 no staticmethod 2012-12-17 04:56:16 -05:00
Kenneth Reitz
4837900832 digest works!
added some nice backwards compatible stuff too
2012-12-17 04:55:58 -05:00
Kenneth Reitz
1c30ef453b remove old auth stuff 2012-12-17 04:33:13 -05:00
Kenneth Reitz
377078b0f5 hooks and things 2012-12-17 04:31:26 -05:00
Kenneth Reitz
2c5b0207f5 new urllib3 2012-12-17 04:08:36 -05:00
Kenneth Reitz
e7598e006c charade v1.0.1 2012-12-17 04:08:03 -05:00
Kenneth Reitz
03c8e23dbb response 2012-12-17 03:56:58 -05:00
Kenneth Reitz
ee6c638e9c hmmm 2012-12-17 03:51:23 -05:00
Kenneth Reitz
2b4ca0b0dc redorder imports 2012-12-17 03:32:24 -05:00
Kenneth Reitz
98a7585fbd cleanup to url logic 2012-12-17 03:29:45 -05:00
Kenneth Reitz
4e5c4a6ab7 further remove config 2012-12-17 03:26:47 -05:00
Kenneth Reitz
8cf6a3593d reduce imports 2012-12-17 03:23:16 -05:00
Kenneth Reitz
e4b56049ad from cookies import extract_cookies_to_jar 2012-12-17 03:21:50 -05:00
Kenneth Reitz
e766f0b67c meh 2012-12-17 03:16:21 -05:00
Kenneth Reitz
f44bb31bec better yield 2012-12-17 03:13:19 -05:00
Kenneth Reitz
b1bcaecc66 MaxRedirects 2012-12-17 03:12:50 -05:00
Kenneth Reitz
94e82e9cc2 murder the defaults 2012-12-17 03:09:07 -05:00
Kenneth Reitz
cc4b0b110f further remove config 2012-12-17 03:08:25 -05:00
Kenneth Reitz
2b5aed78d0 actually honor details 2012-12-17 02:52:39 -05:00
Kenneth Reitz
7fc9378895 iter_json
Closed #1015
2012-12-17 02:42:34 -05:00
Kenneth Reitz
d5572ac13f history is a tuple, not list 2012-12-17 02:32:19 -05:00
Kenneth Reitz
0d183c41a9 epic redirect generator is epic 2012-12-17 02:27:07 -05:00
Kenneth Reitz
0bee888f73 redirects work! 2012-12-17 02:21:22 -05:00
Kenneth Reitz
4a01272fb3 cleanup 2012-12-17 01:25:55 -05:00
Kenneth Reitz
42a206e5d3 better docstrings 2012-12-17 00:27:37 -05:00
Kenneth Reitz
d15365bf4f remove useless attributes 2012-12-17 00:25:45 -05:00
Kenneth Reitz
898079f7e2 license 2012-12-17 00:18:04 -05:00
Kenneth Reitz
9ab3234f0e Merge remote-tracking branch 'origin/master' 2012-12-17 00:10:35 -05:00
Kenneth Reitz
bf05b7aeb5 v1.0.0 2012-12-17 00:10:32 -05:00
Kenneth Reitz
7ec0170a00 keep json None fo row 2012-12-16 22:06:03 -05:00
Kenneth Reitz
8b141b326a json errors 2012-12-16 22:03:55 -05:00
Kenneth Reitz
418a209330 Merge pull request #1012 from bodziec/master
Fixed small bug where user couldn't add custom headers
2012-12-16 12:14:23 -08:00
Bartek Sarul
73ca21ed8c Fixed a bug where user couldn't add custom headers. 2012-12-16 15:59:28 +01:00
Kenneth Reitz
fee7a7a80d Merge pull request #1011 from kuyan/master
Fixed relative import
2012-12-15 20:45:23 -08:00
Natan L
ed360dcaf5 Fixed relative import.
For Python 3 support.
2012-12-15 19:53:56 -08:00
Kenneth Reitz
7ef6b6b682 Merge pull request #1007 from passy/patch-1
Updated Travis CI URL in README
2012-12-15 13:14:41 -08:00
Pascal Hartig
b45a1081d2 Updated travis-ci URL in README
The old URL appears to be broken, redirecting to https://travis-ci.org//kennethreitz/requests

Also, according to [their wiki](http://about.travis-ci.org/docs/user/status-images/) the *secure* isn't required anymore.
2012-12-15 13:12:35 +01:00
Kenneth Reitz
12aa401885 Merge remote-tracking branch 'origin/master' 2012-12-15 05:50:05 -05:00
Kenneth Reitz
92d57036f3 WHOOOOOOOOOOOOOOOO 2012-12-15 05:50:01 -05:00
Kenneth Reitz
58c10edb07 Merge pull request #1006 from passy/test-py3k-fix
Use range in favor of xrange for py3k test compatibility
2012-12-15 02:22:25 -08:00
Kenneth Reitz
c6183d273c fewer comments 2012-12-15 05:19:20 -05:00
Kenneth Reitz
3aefb8edc1 backup 2012-12-15 05:18:23 -05:00
Kenneth Reitz
5ce4b69c9f working!!! 2012-12-15 05:17:37 -05:00
Kenneth Reitz
88d4143018 base adapter 2012-12-15 04:33:48 -05:00
Kenneth Reitz
ab27027aa8 cookies 2012-12-15 04:33:44 -05:00
Kenneth Reitz
2161d8f78d encode files 2012-12-15 03:34:54 -05:00
Kenneth Reitz
31d10c0b2b really coming together 2012-12-15 03:31:13 -05:00
Kenneth Reitz
366e8e8498 basics working 2012-12-15 03:04:42 -05:00
Kenneth Reitz
19e1f2037c session.send() 2012-12-15 00:45:43 -05:00
Kenneth Reitz
edfd0990b5 prepare 2012-12-15 00:45:12 -05:00
Kenneth Reitz
ec5844a3bc test 2012-12-15 00:44:42 -05:00
Kenneth Reitz
4d07cad175 history 2012-12-15 00:12:38 -05:00
Kenneth Reitz
4a9f3572a3 logging handlers
Closes #971
2012-12-14 23:51:53 -05:00
Kenneth Reitz
2acce4221e always get cookies 2012-12-14 23:39:10 -05:00
Kenneth Reitz
79992579c9 remove danger_mode tests 2012-12-14 23:27:38 -05:00
Kenneth Reitz
67c7e496f5 remove safe_mode tests 2012-12-14 23:26:48 -05:00
Kenneth Reitz
966672dbc1 ignore test files 2012-12-14 23:26:41 -05:00
Kenneth Reitz
fa838c7a85 cleanup makefile 2012-12-14 23:11:49 -05:00
Kenneth Reitz
342facb571 Merge pull request #1001 from matthewlmcclure/issues/1000
Import oauthlib without the obsolete wrapper.
2012-12-14 20:07:18 -08:00
Kenneth Reitz
ddf2dde663 Merge pull request #1002 from passy/remove-artifacts
Remove testing artifacts
2012-12-14 20:06:56 -08:00
Pascal Hartig
a98ec717f2 Use range in favor of xrange for py3k compatibility
request_count is 2 so it really makes no difference performance-wise at all.
2012-12-14 23:29:33 +01:00
Pascal Hartig
17aee31940 Removed testing artifacts 2012-12-14 23:08:54 +01:00
Kenneth Reitz
7e47d5ef30 Merge remote-tracking branch 'origin/master' 2012-12-12 16:53:44 -05:00
Kenneth Reitz
584cfb664d trying out egg 2012-12-12 16:53:40 -05:00
Matt McClure
f69934fb24 Import oauthlib without the obsolete wrapper.
Fixes #1000.
2012-12-12 10:45:00 -05:00
Kenneth Reitz
d74bd7e1a2 Merge pull request #998 from jamshid/master
Issue #996 Location should not be followed unless 30X response
2012-12-12 00:09:43 -08:00
Jamshid Afshar
500dc78867 Issue #996 Location should not be followed unless 30X response. 2012-12-11 18:14:13 -06:00
Kenneth Reitz
a7344a034a Merge pull request #991 from lyndsysimon/master
Changes license from ISC to Apache2
2012-12-06 10:21:15 -08:00
Lyndsy Simon
710f09f806 Updates from ISC to Apache2 2012-12-05 16:19:14 -06:00
Kenneth Reitz
25b9b2330e Merge pull request #987 from Lukasa/master
Update docs to reflect correct use of raw.
2012-12-04 17:34:20 -08:00
Cory Benfield
93b2be48f0 Prefetch must be false to use response.raw.
Resolves issue #979.
2012-12-04 18:10:33 +00:00
Kenneth Reitz
f2820ee8c4 Merge pull request #985 from ming13/readme-syntax-highlighting
Use console syntax highlighting in the readme file
2012-12-03 09:23:33 -08:00
Artur Dryomov
1a08cea007 Use console syntax highlighting in the readme file. 2012-12-03 20:20:47 +03:00
Kenneth Reitz
ce595d4da7 Merge pull request #983 from jszakmeister/allow-strict
Add the ability to turn off HTTP 0.9 support.
2012-12-02 08:43:31 -08:00
John Szakmeister
ed642cfb6d Add the ability to turn off HTTP 0.9 support.
While debugging an issue I discovered requests was coming back with 200
response, when it really shouldn't have.  It turns out this happened for
two reasons: the jetty server running the app was rather lame and
didn't fail the request as a Bad Request, and httplib was happy to let
malformed data through and call it success.

It turns out httplib's strict flag controls this behavior of whether or
not to validate the status line.  The underlying urllib3 supports the
concept as well.  There was a bug there to that is now fixed upstream.

The last step is exposing this through requests.  This introduces a
supports_http0.9 flag to help control this behavior.  It defaults to
to True to preserve the current behavior.   Setting it to False will
allow the underlying HTTPConnection to validate the status line.
2012-12-02 11:25:18 -05:00
Kenneth Reitz
3b5d580409 Merge remote-tracking branch 'origin/master' 2012-12-02 10:09:05 +01:00
Kenneth Reitz
ad311497fa update charade 2012-12-02 10:08:57 +01:00
Kenneth Reitz
33eb76f958 Merge pull request #982 from vlaci/master
Added support for persistent connections (keep-alive) in proxy mode
2012-12-02 00:56:44 -08:00
László Vaskó
5eb78876e1 Added support for persistent connections (keep-alive) in proxy mode 2012-12-02 01:28:24 +01:00
László Vaskó
e8d20926d3 Added testcases for keep-alive handling
* Added a dummy_server module to check connection count
* Added testcases for proxy and direct connections
2012-12-02 01:06:52 +01:00
Kenneth Reitz
23e6f533b0 Merge pull request #980 from dbrgn/github_name_change
Github name change
2012-12-01 07:56:47 -08:00
Kenneth Reitz
b60b11e206 Merge remote-tracking branch 'origin/master' 2012-12-01 16:55:14 +01:00
Kenneth Reitz
2eb63be19a chardet fixes! 2012-12-01 16:55:09 +01:00
Danilo Bargen
8798dd5eda Github name change 2012-12-01 15:38:03 +01:00
Kenneth Reitz
426734da51 Merge pull request #977 from ondrowan/patch-2
Update README.rst
2012-11-29 10:59:49 -08:00
Ondrej Slinták
ae41c733ea Update README.rst
There was a typo in AUTHORS link - it pointed to develop branch which no longer exists.
2012-11-29 19:58:46 +01:00
Kenneth Reitz
a5cb6355ed Merge branch 'master' of github.com:kennethreitz/requests
Conflicts:
	requests/compat.py
	setup.py
2012-11-29 08:35:35 -08:00
Kenneth Reitz
6ead850065 charade 2012-11-29 08:30:07 -08:00
Kenneth Reitz
1960dabafd out with chardet, in with charade 2012-11-29 08:29:02 -08:00
Kenneth Reitz
8f86ff633a Merge pull request #973 from sigmavirus24/fix_972
Fix #972
2012-11-28 08:40:09 -08:00
Kenneth Reitz
4d5c327f6f Merge pull request #976 from futoase/master
Repaired import error.
2012-11-28 08:33:56 -08:00
Keiji Matsuzaki
b69854e96e Modified: Change the import statement. 2012-11-29 01:29:13 +09:00
Ian Cordasco
fd6b1f0c4e Fix #972
Someone forgot a comma
2012-11-27 22:14:09 -05:00
Kenneth Reitz
ccd14ddc81 fixes for python2 2012-11-27 13:08:16 -08:00
Kenneth Reitz
0af19a05ce fix chardet import 2012-11-27 12:52:17 -08:00
Kenneth Reitz
f553857beb remove safe mode 2012-11-27 12:42:11 -08:00
Kenneth Reitz
1607a6a3e2 remove danger mode 2012-11-27 12:41:28 -08:00
Kenneth Reitz
95a03532c3 remove strict mode 2012-11-27 12:41:12 -08:00
Kenneth Reitz
400046f911 that shouldn't be neccesary anymore 2012-11-27 12:37:59 -08:00
Kenneth Reitz
71898bb793 chardet2 is magic 2012-11-27 12:36:29 -08:00
Kenneth Reitz
ad18d9ddd6 fix setup.py for oauth removal 2012-11-27 11:48:17 -08:00
Kenneth Reitz
4d06e4019f no more oauth 2012-11-27 11:47:17 -08:00
Kenneth Reitz
5c1bc201c4 lawyer up, v2 2012-11-27 11:32:59 -08:00
Kenneth Reitz
cc723a64b9 Merge pull request #967 from matthewlmcclure/sign-without-body
Sign requests even if they have no body data.
2012-11-27 10:43:57 -08:00
Matt McClure
f02573f743 Sign requests even if they have no body data. 2012-11-27 13:12:21 -05:00
Kenneth Reitz
7fea9afecd Merge remote-tracking branch 'origin/develop' into develop 2012-11-26 20:50:09 -08:00
Kenneth Reitz
a1b6ef3f85 how was that still there? 2012-11-26 17:27:35 -08:00
Kenneth Reitz
2dccc8e982 Merge pull request #962 from sigmavirus24/dev_docs
Add a bit more to the developer's documentation
2012-11-26 12:26:38 -08:00
Ian Cordasco
24ed8c9457 Add a bit more to the developer's documentation
I'm not sure what else could be added to satisfy #601. If this is sufficient,
I suggest closing that.
2012-11-26 13:25:02 -05:00
Kenneth Reitz
0d59a27b56 Merge pull request #956 from Lukasa/issue910
Try to resolve OAuth+JSON problems.
2012-11-26 00:40:27 -08:00
Kenneth Reitz
d36ceb9d06 Merge pull request #953 from heyman/fix_session_safe_mode
Fixes so that safe_mode works for Sessions
2012-11-26 00:31:45 -08:00
Kenneth Reitz
27faf7aa69 Merge pull request #955 from Lukasa/issue882
Python 3.1 compatibility.
2012-11-26 00:30:49 -08:00
Kenneth Reitz
5ee00a75e0 Merge pull request #957 from sigmavirus24/fix_223
Attach Content-Length to everything.
2012-11-24 19:54:29 -08:00
Ian Cordasco
b93fbd30c3 Fix python 3 tests. 2012-11-24 22:43:52 -05:00
Ian Cordasco
61f16d1ddc Handle files as well. 2012-11-24 22:02:14 -05:00
Ian Cordasco
f003025a37 Attach Content-Length to everything.
Closes #223
2012-11-24 21:47:47 -05:00
Cory Benfield
31f74bd02e Make OAuth handle less-common body data better.
Related to Issue #910. Specifically, OAuth won't sign the request unless
it gets a body type that is urlencoded or multipart. This is overly
restrictive. The correct behaviour is to sign the message without
including the body as part of the signature.
2012-11-24 21:17:29 +00:00
Cory Benfield
d5f9a2a51c Avoid using callable().
Callable() is not included in Python 3.1, so we shouldn't use it.
2012-11-24 12:15:30 +00:00
Jonatan Heyman
8269ee7266 Fixed so that safe_mode works for Sessions 2012-11-23 16:48:51 +01:00
Kenneth Reitz
991f47ac08 Merge pull request #942 from Lukasa/issue883
MockRequest needs a type property for Py3.3
2012-11-23 02:04:21 -08:00
Kenneth Reitz
1d1eb994dc Merge pull request #945 from Lukasa/develop
Respect the no_proxy environment variable.
2012-11-23 02:03:28 -08:00
Kenneth Reitz
68224252e2 Merge pull request #947 from JohnPeacockMessageSystems/develop
Only return a path if the cacert.pem file exists.
2012-11-23 02:02:18 -08:00
Kenneth Reitz
36c32aead2 Merge pull request #948 from mwielgoszewski/develop
Back to issue #630, .isalnum() was sufficient in addressing the issue.
2012-11-23 02:01:20 -08:00
Marcin Wielgoszewski
18be26fc2a Back to issue #630, .isalnum() was sufficient in addressing the issue.
Adding a try/except block just masks any issues that are raised here, issues that the developer should definitely be made aware of.
2012-11-22 11:10:22 -05:00
Kenneth Reitz
59dea188da Merge remote-tracking branch 'origin/develop' into develop 2012-11-21 17:59:11 -05:00
Kenneth Reitz
284deaa609 obama 2012-11-21 17:58:13 -05:00
John Peacock
68f7fae7c3 Merge branch 'develop' of github.com:JohnPeacockMessageSystems/requests into develop 2012-11-21 13:41:39 -05:00
John Peacock
20cd46426f Only return a path if the cacert.pem file exists.
This will permit the deletion of just that one file in order
to fall back to the [probably more accurate but less consistent]
Distro provided CA certs.
2012-11-21 13:41:16 -05:00
John Peacock
c5fddb95ed Only return a path if the cacert.pem file exists.
This will permit the deletion of just that one file in order
to fall back to the [probably more accurate but less consistent]
Distro provided CA certs.
2012-11-21 13:34:03 -05:00
Cory Benfield
c02520ed99 Make sure we reset environment variables.
Turns out nose runs all the tests in one process, so changing the
os.environ dictionary makes everything go horribly wrong.
2012-11-18 12:31:55 +00:00
Cory Benfield
8da100f652 Respect the no_proxy environment variable.
This change is in response to issue #879.
2012-11-18 12:06:33 +00:00
Cory Benfield
b76326bf94 MockRequest needs a type property for Py3.3 2012-11-17 13:00:39 +00:00
Kenneth Reitz
50877717c8 Merge pull request #940 from Lukasa/issue917
Update docs to reflect use of params
2012-11-17 03:03:32 -08:00
Kenneth Reitz
47299421df Merge pull request #941 from Lukasa/issue870
Update documentation on Sessions.
2012-11-17 03:03:03 -08:00
Cory Benfield
0792acc130 Update documentation on Sessions.
This resolves issue #870. Better documentation here should be considered
for further work.
2012-11-17 10:57:26 +00:00
Cory Benfield
c8b2f7a37b Update docs to reflect use of params
Resolves issue #917.
2012-11-16 23:05:35 +00:00
Kenneth Reitz
dea8e96bd5 Merge pull request #925 from russelldavis/fix-encoding
Fix a bug in _encode_params
2012-11-15 02:13:30 -08:00
Kenneth Reitz
dda2fbd1ec Merge pull request #937 from cleg/develop
Fix for default_user_agent when SIGCHILD intercepted
2012-11-15 02:11:55 -08:00
Pavel Dmitriev
a02f3dec02 Fix for user-agent setting 2012-11-13 17:40:13 +02:00
Kenneth Reitz
5333ec9331 Merge pull request #930 from maxcountryman/status-codes
adding UTF-8 status codes
2012-11-08 16:24:36 -08:00
Max Countryman
32aa3eb012 adding UTF-8 status codes 2012-11-08 14:30:13 -08:00
Kenneth Reitz
5a06ffd286 Merge pull request #921 from bmcustodio/setuptools-fixes
Added 'zip_safe' flag to 'setup.py' & Fixed typo in 'MANIFEST.in'
2012-11-07 22:08:32 -08:00
Russell Davis
ccf4ca8929 Fix a bug in _encode_params - it wasn't utf-8 encoding strings in values that
are iterable but not a list.
2012-11-03 12:58:04 -07:00
bmcustodio
f8603918db Fixed typo in 'MANIFEST.in'. 2012-10-30 15:25:46 +00:00
bmcustodio
ec852c1e5a Added 'zip_safe' flag to 'setup.py'. 2012-10-30 15:25:36 +00:00
Kenneth Reitz
63243b1e3b v0.14.2 2012-10-27 10:08:40 -05:00
Kenneth Reitz
5c63bc33fe v0.14.2 2012-10-27 10:08:16 -05:00
Kenneth Reitz
28dc725cfe Merge pull request #909 from mjpieters/issue765-json-encodings
Use a JSON-specific encoding detection when no encoding has been specified
2012-10-27 08:02:55 -07:00
Kenneth Reitz
2c9bee2597 Merge pull request #912 from jhalcrow/develop
Make sure that url has fragment removed when using a proxy
2012-10-27 08:01:17 -07:00
Jonathan Halcrow
724a3889bc Make sure that url has fragment removed when using a proxy 2012-10-27 09:54:31 -04:00
Martijn Pieters
e26ccb34eb Fix the smoke test in the face of UTF-16 surrogate pairs.
If the random data starts with a UTF-16 BOM *and* the next two bytes are for a character in the `\ud800`-`\udfff` range decoding would fail. Small chance, but still possible.

Extend it to check the UTF-8 error as well. The goal is to test that the guesser was *mostly* correct, and to verify the cases where it wasn't that it was to be expected. Most of all that the function doesn't buckle under wildly unexpected data.
2012-10-26 12:15:27 +02:00
Martijn Pieters
be01a35ef1 Better not call it chr, rename to byteschr. 2012-10-25 18:27:21 +02:00
Martijn Pieters
a4be9a2578 Redefine the unichr and bytes-variant of chr at module level.
Needed to appease Travis; it's python 2.6 and 2.7 builds are weird and the `__builtins__` dict is not following CPython conventions.
2012-10-25 18:22:07 +02:00
Martijn Pieters
25f2806f23 Cheek: insert myself into AUTHORS.rst. 2012-10-25 18:12:55 +02:00
Martijn Pieters
9832bd8917 Correct a c&p mistake: set a correct docstring for the unit test class. 2012-10-25 17:56:19 +02:00
Martijn Pieters
4decc7986e Use a JSON-specific encoding detection when no encoding has been specified.
JSON *must* be encoded using UTF-8, UTF-16 or UTF-32 (see the [RFC][1]; detect the encoding based on the fact that JSON always starts with 2 ASCII characters.

[1]: http://tools.ietf.org/html/rfc4627#section-3
2012-10-25 17:43:52 +02:00
Kenneth Reitz
6e0ad1eca5 Merge pull request #906 from Atheuz/develop
quote_plus, unquote_plus added
2012-10-22 16:49:15 -07:00
Lasse Vang Gravesen
b36863b2c0 quote_plus, unquote_plus added
compat.py: relevant imports added
utils.py: then those imports are imported here.

Nothing else was changed, but I saw mentions of quoting later in
utils.py but I wasnt sure what to do about that.
2012-10-22 23:58:49 +02:00
Kenneth Reitz
cfa83f6214 Merge pull request #903 from building39/issue-901
Issue 901:
2012-10-21 08:52:03 -07:00
Kenneth Reitz
4778bdbaab Merge pull request #904 from g2p/develop
Remove path hacks that break chardet in Python 3. Closes #858.
2012-10-21 08:49:38 -07:00
Gabriel
c03553ed4a Remove path hacks that break chardet in Python 3. Closes #858.
This replaces the sys.path hack with a slightly less objectionable
sys.modules hack.

Both have the effect of making the vendored lib's absolue imports work
as expected when oauthlib isn't installed. The sys.modules hack doesn't
insert the rest of the vendored crap in a global path, however.
2012-10-21 17:07:12 +02:00
Kenneth Reitz
4477d0a4e5 Merge pull request #898 from rvoicilas/develop
Replace assert statements with unittest's self.assert*
2012-10-20 05:37:57 -07:00
mmartin
4dfa51ae03 Issue 901:
Make value of Contents-Encoding header case insensitive per RFC 2616.
2012-10-19 14:17:32 -05:00
Radu Voicilas
ce7c86cc58 Replace assert statements with unittest's self.assert*
-- the incetive for this being that with self.assertEqual you get an
error message if the test fails
2012-10-18 22:24:59 +03:00
Kenneth Reitz
a74c6c6314 Merge remote-tracking branch 'origin/develop' into develop 2012-10-17 22:46:12 -07:00
Kenneth Reitz
b73426aaca exactly 2012-10-17 22:45:24 -07:00
Kenneth Reitz
aa08f33f98 Merge pull request #884 from everbird/develop
Support CJK parameters when post files
2012-10-17 07:21:39 -07:00
Kenneth Reitz
c631627403 Merge pull request #887 from rvoicilas/develop
Small changes to make the code more PEP8 compliant
2012-10-17 07:20:55 -07:00
Kenneth Reitz
2363243964 Merge pull request #897 from ametaireau/fix-cheeseshop-mirror-url
Fix the cheeseshop mirror url from pip.kennethreitz to crate.io
2012-10-17 06:37:26 -07:00
Alexis Métaireau
78dbb5bfbe Fix the cheeseshop mirror url from pip.kennethreitz to crate.io, since the former doesn't work anymore. 2012-10-17 15:28:09 +02:00
Kenneth Reitz
1a0af611cb Merge pull request #892 from treyhunner/topic/whitespace-fixes
Fix multiple code style (whitespace) in docs/
2012-10-15 12:55:51 -07:00
Trey Hunner
481622ff16 Fix multiple code style (whitespace) in docs/ 2012-10-15 11:17:09 -07:00
Kenneth Reitz
9840966d72 typo all the things 2012-10-13 00:46:46 +01:00
Kenneth Reitz
c3fc2dd259 Merge remote-tracking branch 'origin/develop' into develop 2012-10-13 00:45:20 +01:00
Kenneth Reitz
f33a0aa47b oauth awesomeness 2012-10-13 00:45:05 +01:00
Stephen Zhuang
bb9e72885a For the uniformity :) 2012-10-09 23:19:42 +08:00
Stephen Zhuang
2d9f953d4c Add name to AUTHORS according to Contribute section 2012-10-09 11:20:48 +08:00
Radu Voicilas
820dfb0495 Making the code more PEP8 compliant 2012-10-09 00:42:49 +03:00
tokuda109
5ec2c96f02 declare the encoding 2012-10-09 00:42:49 +03:00
Kenneth Reitz
3e30196917 update 2012-10-09 00:42:49 +03:00
Kenneth Reitz
cc1b9da235 wording 2012-10-09 00:42:49 +03:00
Kenneth Reitz
1444d9033a padding 2012-10-09 00:42:49 +03:00
Kenneth Reitz
e60e82c729 order fix 2012-10-09 00:42:49 +03:00
Kenneth Reitz
582a53f3f4 why not 2012-10-09 00:42:49 +03:00
Ian Cordasco
4e6cf21d82 Only register callable items in lists
Prior to this, you could sneak a list of anything to register_hook and it
would accept it. This will check if the items in the list are callable before
registering them. Also added a regression test to make sure if this gets
changed it will be noticed.
2012-10-09 00:42:49 +03:00
Kenneth Reitz
46fd297c3a new classifiers for 3.2+ 2012-10-09 00:42:49 +03:00
Kenneth Reitz
ed8a3f3199 v0.14.1 2012-10-09 00:42:48 +03:00
yegle
22fdecba52 Update: @property decorator instead of __getattr__ 2012-10-09 00:42:48 +03:00
Kunal Mehta
4f9e552148 Use __iter__ rather than the inefficient nested for loops 2012-10-09 00:42:48 +03:00
yegle
e656222188 Python 3.3 compatible update
httplib.cookiejar.DefaultCookiePolicy changed its implementation of
set_ok_verifiability.
2012-10-09 00:42:48 +03:00
Matt Sweeney
eb6a6b1a23 Simplify error handling when decoding unicode 2012-10-09 00:42:48 +03:00
Matt Sweeney
2bb49ff386 Handle encoding of None when decoding unicode
If encoding is None, decoding will throw the following TypeError:
TypeError: unicode() argument 2 must be string, not None

If this is the case, attempt to run without any set encoding
2012-10-09 00:42:48 +03:00
Stephen Zhuang
86b39bf3e3 Support CJK parameters when post files 2012-10-08 16:52:06 +08:00
Kenneth Reitz
0c0254453f Merge pull request #878 from tokuda109/encoding
miss the encoding declaration
2012-10-02 08:25:16 -07:00
tokuda109
601a2b8c74 declare the encoding 2012-10-02 23:26:29 +09:00
Kenneth Reitz
490ed74187 update 2012-10-02 01:02:32 -04:00
Kenneth Reitz
af5ae235e6 wording 2012-10-02 01:01:28 -04:00
Kenneth Reitz
8d239a3739 padding 2012-10-02 00:44:57 -04:00
Kenneth Reitz
ed5c728c52 order fix 2012-10-02 00:44:21 -04:00
Kenneth Reitz
f1ffe19506 Merge remote-tracking branch 'origin/develop' into develop 2012-10-02 00:43:28 -04:00
Kenneth Reitz
ccf55045a6 why not 2012-10-02 00:43:21 -04:00
Kenneth Reitz
1e61cf5cba Merge pull request #876 from sigmavirus24/register_hook_fix
Only register callable items in lists
2012-10-01 11:15:47 -07:00
Ian Cordasco
77677eb71d Only register callable items in lists
Prior to this, you could sneak a list of anything to register_hook and it
would accept it. This will check if the items in the list are callable before
registering them. Also added a regression test to make sure if this gets
changed it will be noticed.
2012-10-01 14:05:27 -04:00
Kenneth Reitz
7c520ece69 new classifiers for 3.2+ 2012-10-01 13:30:41 -04:00
Kenneth Reitz
9dce786113 v0.14.1 2012-10-01 13:29:38 -04:00
Kenneth Reitz
6d706378a0 Merge pull request #871 from yegle/develop
Python 3.3 compatible update
2012-10-01 10:26:58 -07:00
yegle
170c46c06b Update: @property decorator instead of __getattr__ 2012-10-01 13:13:12 -04:00
Kenneth Reitz
af61205e72 Merge pull request #867 from mattswe/patch-1
Handle encoding of `None` when decoding unicode
2012-10-01 09:53:56 -07:00
Kenneth Reitz
1cb31f2b11 Merge pull request #873 from legoktm/develop
Use __iter__ rather than the inefficient nested for loops
2012-10-01 09:52:31 -07:00
Kunal Mehta
5cd116d078 Use __iter__ rather than the inefficient nested for loops 2012-09-30 19:24:56 -05:00
yegle
992d1182db Python 3.3 compatible update
httplib.cookiejar.DefaultCookiePolicy changed its implementation of
set_ok_verifiability.
2012-09-29 18:28:53 -04:00
Matt Sweeney
38aced9f90 Simplify error handling when decoding unicode 2012-09-26 12:38:36 -07:00
Matt Sweeney
b1610df282 Handle encoding of None when decoding unicode
If encoding is None, decoding will throw the following TypeError:
TypeError: unicode() argument 2 must be string, not None

If this is the case, attempt to run without any set encoding
2012-09-25 15:35:30 -07:00
Kenneth Reitz
5ce25688e0 Revert "Fix SSL3 error on Ubuntu 12.04"
This reverts commit c19650b00f.
2012-09-24 11:05:53 -05:00
Kenneth Reitz
1b70385d4a change default accept-encoding
http://blogs.operationaldynamics.com/andrew/software/research/testing-re
stful-apis-with-httpie
2012-09-23 12:41:54 -05:00
Kenneth Reitz
6cc24a11fd amazon 2012-09-23 11:47:22 -05:00
Kenneth Reitz
6a4062a8c7 Merge pull request #863 from sigmavirus24/fix_hooks
Fix #785 & add regression test.
2012-09-22 18:49:19 -07:00
Kenneth Reitz
c91f83fbad 1,000,000 2012-09-21 15:50:38 -07:00
Kenneth Reitz
ffc72ac5f9 Merge remote-tracking branch 'origin/develop' into develop 2012-09-21 15:22:18 -07:00
Kenneth Reitz
efdd645dbc epic 2012-09-21 15:22:12 -07:00
Ian Cordasco
4dd3d1a1a2 Fix #785 & add regression test. 2012-09-20 11:45:03 -04:00
Kenneth Reitz
a0df2cbb10 Merge pull request #853 from plaes/docs-license-missing-ref
Create label for the ISC License, which is referenced from the index page
2012-09-12 23:36:36 -07:00
Priit Laes
cb44e165e5 Create label for the ISC License, which is referenced from the index page 2012-09-13 09:21:32 +03:00
Kenneth Reitz
0342ddb548 Merge pull request #852 from plaes/docs-include-license
Use the include directive instead of rewriting the license in docs.
2012-09-12 23:10:11 -07:00
Priit Laes
fe4211d5b5 Use the include directive instead of rewriting the license in docs.
Helps also keeping the copyright years in sync \o/
2012-09-13 09:03:38 +03:00
Kenneth Reitz
d70964a608 Merge pull request #848 from barberj/develop
None is not iterable
2012-09-12 10:58:20 -07:00
Kenneth Reitz
106bae6457 Merge pull request #850 from SecurityForUs/fix_proxies_2.7-3
Resolve issue in #849
2012-09-12 10:58:03 -07:00
Eric Hansen
65c19bc0e0 Fix for v3 in deleting empty proxies. 2012-09-12 13:49:34 -04:00
Eric Hansen
2dc7db4730 Fixed issue with empty proxies being passed 2012-09-11 15:40:16 -04:00
barberj
fc1d0fedea None is not iterable 2012-09-11 08:39:10 -04:00
Kenneth Reitz
64fd0baa02 Merge pull request #841 from sigmavirus24/bytecode
Reset PYTHONDONTWRITEBYTECODE after installation
2012-09-10 20:15:41 -07:00
Ian Cordasco
aed5bf7cc7 As per the discussion on #841. 2012-09-10 23:09:41 -04:00
Ian Cordasco
91a9c39746 Reset PYTHONDONTWRITEBYTECODE after installation
Fixes #839.
2012-09-10 23:09:14 -04:00
Kenneth Reitz
b7c3945437 Merge pull request #820 from dergraf/develop
Data encoding should take place after calling into auth provider
2012-09-10 20:06:52 -07:00
Kenneth Reitz
2ae7c5a547 Merge pull request #833 from sigmavirus24/fix_key_val_args
Fixes #817.
2012-09-10 20:05:07 -07:00
Kenneth Reitz
f58013c089 Merge pull request #845 from alanhamlett/patch-1
fixed typo in docs
2012-09-09 02:29:37 -07:00
Alan Hamlett
861e63ce8e fixed typo in docs 2012-09-09 01:56:32 -07:00
Kenneth Reitz
ee7825df7b Merge pull request #842 from slingamn/test_tweak
fix some tests to correctly cover the API
2012-09-07 00:10:21 -07:00
Kenneth Reitz
41ca8edf23 Merge pull request #840 from gareth-lloyd/develop
add prefetch=False to streaming example
2012-09-07 00:06:51 -07:00
Shivaram Lingamneni
c73646da00 fix some tests to correctly cover the API
After #831, the tests added in #764 (which relied on iter_content()
crashing if the response was prefetched) no longer tested what they
were intended to test.
2012-09-06 16:31:01 -07:00
Gareth Lloyd
d9a85560a2 add prefetch=False to streaming example 2012-09-06 15:13:46 +01:00
Ian Cordasco
8081d7b15c Fixes #817.
Use dicts and lists where necessary but accept both dicts and lists of
2-tuples everywhere.
2012-09-02 23:10:28 -04:00
Kenneth Reitz
c8f166f696 Merge remote-tracking branch 'origin/develop' into develop 2012-09-02 04:50:30 -04:00
Kenneth Reitz
a69cf7e71c v0.14.0 2012-09-02 04:50:05 -04:00
Kenneth Reitz
6497d11049 Merge pull request #831 from slingamn/permissive_itercontent_2
permissive implementation of iter_content
2012-09-02 01:47:19 -07:00
Shivaram Lingamneni
77cf995165 permissive implementation of iter_content
This allows iter_content and iter_lines to succeed without
crashing even after the response content has been fetched
(iter_content gives you an iterator over the prefetched
content)
2012-09-02 01:42:30 -07:00
Kenneth Reitz
1175866033 Merge pull request #826 from hazzadous/develop
Updated content workflow section of the advanced user docs
2012-08-31 16:49:47 -07:00
Kenneth Reitz
81897dd138 Merge remote-tracking branch 'origin/develop' into develop 2012-08-31 02:06:21 -04:00
Kenneth Reitz
5fedbbf7f0 oops 2012-08-31 02:06:15 -04:00
Harry Waye
991b853bd9 Updated content workflow section of the advanced use docs 2012-08-30 18:14:37 +01:00
Andre Graf
52d2e2ee4e added myself 2012-08-29 21:20:27 +02:00
Andre Graf
06d9faedc6 data encoding must be done after calling an auth provider which might change the data (as auth.OAuth1 does) 2012-08-29 21:20:11 +02:00
Kenneth Reitz
0ad445651e Merge pull request #819 from ayanamist/develop
Correct OAuth1 with query or data.
2012-08-29 04:29:41 -07:00
ayanamist
babac7368b Change variable name "_cond" -> "_oauth_signed". 2012-08-28 15:38:13 +08:00
ayanamist
aded42f232 Try to keep the header too if content-type is application/x-www-form-urlencoded 2012-08-28 15:24:09 +08:00
ayanamist
46ff4b3862 Fix the comment too.
If content-type is multipart/form-data, keep the header.
2012-08-28 15:20:53 +08:00
Kenneth Reitz
b5b2e51fc5 Merge pull request #818 from r1chardj0n3s/develop
improve top-level docstring
2012-08-27 22:38:46 -07:00
ayanamist
8a1d53eb3a Correct OAuth1 with query or data. 2012-08-28 12:52:32 +08:00
Richard Jones
f4311269d7 improve top-level docstring 2012-08-28 09:36:00 +10:00
Kenneth Reitz
b9ecf45683 Merge remote-tracking branch 'origin/develop' into develop 2012-08-26 18:34:16 -04:00
Kenneth Reitz
b257b10281 typo 2012-08-26 18:34:09 -04:00
Kenneth Reitz
9fb63adfa5 Merge pull request #814 from asapo/develop
import cchardet if available
2012-08-26 09:47:09 -07:00
Kenneth Reitz
ace89395b6 Merge pull request #815 from ayanamist/develop
Use logger instead of direct logging call.
2012-08-26 09:46:18 -07:00
ayanamist
913ef867be Use logger instead of direct logging call. 2012-08-27 00:43:39 +08:00
asapo
fc9b8a0214 import cchardet if available 2012-08-27 01:30:04 +09:00
Kenneth Reitz
6da48dbd93 no . 2012-08-25 11:46:41 -04:00
Kenneth Reitz
1be2a55a39 Remove exception eating from dispatch_hook. 2012-08-25 11:07:13 -04:00
Kenneth Reitz
ab57c076e3 Merge pull request #811 from lucian1900/develop
Remove exception eating from dispatch_hook.
2012-08-25 08:06:56 -07:00
Kenneth Reitz
94869e720e v0.13.9 2012-08-25 10:49:16 -04:00
Kenneth Reitz
f65b790e9d Cleanup #800 2012-08-25 10:44:53 -04:00
Kenneth Reitz
fa44921241 Merge pull request #800 from ayanamist/develop
Fix kennethreitz/requests#790
2012-08-25 07:41:15 -07:00
Kenneth Reitz
088454b145 Merge pull request #805 from Lukasa/develop
Remove None values from post data.
2012-08-25 07:35:06 -07:00
Kenneth Reitz
4571a9e50e Merge remote-tracking branch 'origin/develop' into develop 2012-08-25 10:33:42 -04:00
Kenneth Reitz
95c82c7c0b Merge branch 'develop' of git://github.com/weak/requests into develop 2012-08-25 10:33:37 -04:00
Kenneth Reitz
390a4ae4bc Merge pull request #806 from rhyselsmore/develop
General Housekeeping
2012-08-24 21:48:30 -07:00
Rhys Elsmore
29aa21a2fd Not sure if meant to be pluralized 2012-08-23 16:38:28 +10:00
Rhys Elsmore
217a9d50cd Removed Duplicate Import 2012-08-23 16:18:47 +10:00
Cory Benfield
751e7a0a66 Do not post None values in data. 2012-08-22 22:33:25 +01:00
Cory Benfield
b781acc7ab Add a failing test for Issue #378. 2012-08-22 22:33:20 +01:00
Andrew Tolbert
f18733d2be Fix for #804 - Session params ommited in 0.13.8. If default_kwarg is a list, attempt to convert to dictionary 2012-08-22 09:49:40 -05:00
Kenneth Reitz
4889adce4e Merge pull request #802 from Lukasa/develop
Tiny formatting changes in Advanced docs
2012-08-20 09:04:44 -07:00
Cory Benfield
b5ce5029ea Cleanup Advanced doc and remove `.:' from docs 2012-08-20 16:58:43 +01:00
Kenneth Reitz
9eaee76c33 v0.13.8 2012-08-21 01:15:50 +10:00
Kenneth Reitz
c323047dbe no more multidict 2012-08-21 01:10:55 +10:00
Kenneth Reitz
d8dcd35316 Fixes #711! 2012-08-21 01:06:33 +10:00
Kenneth Reitz
0841940aea Merge remote-tracking branch 'origin/develop' into develop 2012-08-21 00:55:31 +10:00
Kenneth Reitz
a320336b5c Merge pull request #801 from rhyselsmore/develop
Added in a link handler as per issue #711
2012-08-20 07:54:48 -07:00
Kenneth Reitz
7c23fa364f Rhys 2012-08-21 00:54:39 +10:00
Kenneth Reitz
49a7947bcb link docs! 2012-08-21 00:52:09 +10:00
Rhys Elsmore
f3159ed4f6 Added in a link handler as per issue #711 2012-08-21 00:47:19 +10:00
Kenneth Reitz
3514816d63 Merge remote-tracking branch 'origin/develop' into develop 2012-08-21 00:43:27 +10:00
Kenneth Reitz
e5fc88ad37 MultiDict 2012-08-21 00:43:16 +10:00
Kenneth Reitz
a032e7c392 link headers 2012-08-21 00:43:05 +10:00
ayanamist
301d1a838f Fix kennethreitz/requests#790 2012-08-20 17:18:26 +08:00
Kenneth Reitz
2d5d6f99ab Merge pull request #797 from sigmavirus24/fix_order
Fix order of data+params
2012-08-20 00:55:17 -07:00
Kenneth Reitz
2e71497e10 Merge pull request #799 from joequery/ubuntu_ssl_error
Fix SSL3 error on Ubuntu 12.04
2012-08-19 22:38:39 -07:00
Joseph McCullough
c19650b00f Fix SSL3 error on Ubuntu 12.04 2012-08-19 22:10:18 -05:00
Ian Cordasco
6d418d9132 Fix a fairly critical error on my part. 2012-08-19 16:38:40 -04:00
Ian Cordasco
f48c78c9ee Change ordering of data + params back.
Fixes #795
2012-08-19 16:38:32 -04:00
Kenneth Reitz
b130b98086 v0.13.7 2012-08-19 10:46:55 +10:00
Kenneth Reitz
385217e55c Merge pull request #789 from zigmonty/http_digest_fixes
HTTPDigestAuth fixes
2012-08-18 17:42:40 -07:00
Kenneth Reitz
489ce1c8a9 Merge pull request #779 from Lukasa/develop
Make sure proxy exclusions work properly.
2012-08-18 17:40:53 -07:00
Kenneth Reitz
95493917f2 Merge pull request #791 from sigmavirus24/key_val_lists
Key val lists
2012-08-18 15:54:49 -07:00
Ian Cordasco
a5d462e176 Revert "Some pyflakes fixes."
This reverts commit c71f48b5f1.

To please his BDFLness @kennethreitz ;)
2012-08-18 18:31:58 -04:00
Kenneth Reitz
00523064b0 Merge pull request #793 from Lukasa/typo
Typo fix in tests.
2012-08-18 14:32:48 -07:00
Ian Cordasco
329af44f35 Forgot to add myself to the AUTHORS.rst
[ci skip]
2012-08-18 16:39:52 -04:00
Cory Benfield
a04775f862 Typo fix in tests. 2012-08-18 21:24:02 +01:00
Ian Cordasco
ab56e4a9f1 Fix python3 tests.
I wasn't thorough enough with how I dealt with headers. Most of the header
logic in the Request object utilizes dictionary properties which will not work
with a key/value list.

I'll dig more into this, but I know the rest of the features are more
important so I'll take my time on this and send a separate pull request.
2012-08-18 14:41:13 -04:00
Ian Cordasco
f01694e274 All tests pass, time for a PR. 2012-08-18 13:47:14 -04:00
Ian Cordasco
e02da89337 Merge branch 'develop' into key_val_lists
Conflicts:
	requests/models.py
	tests/test_requests.py

Remove some of Lukasa's duplication of my efforts in _encode_data.
2012-08-18 12:15:03 -04:00
Peter Montagner
6d02036092 Extend digests test case to connect twice using the same auth and confirm the second one went direct. 2012-08-18 15:33:05 +10:00
Peter Montagner
5017aeb06c Save credentials in the HTTPDigestAuth object and replay them if the user reuses the object. 2012-08-18 14:31:24 +10:00
Peter Montagner
53d454c813 Release connection in digest auth 401 handler to allow the connection to be reused. 2012-08-18 12:53:57 +10:00
Kenneth Reitz
cb0fdd80d0 Merge pull request #784 from Locker537/docs_fix
Change variable '_r' to 'r' for consistency.
2012-08-17 13:59:29 -07:00
Kenneth Reitz
27f34a5487 Merge pull request #786 from Locker537/lint_fix
Lint fixes following PEP8.
2012-08-17 13:57:01 -07:00
Kenneth Reitz
bbf1946dfe Merge pull request #787 from kayzh/develop
"There many ..." to "There are many ..." in quickstart
2012-08-17 13:47:47 -07:00
Kay Zhu
76f90054f9 "There many ..." to "There are many ..." in quickstart 2012-08-17 06:12:15 -04:00
Locker537
42d0a2169e Whitespace fixes following PEP8. 2012-08-16 17:38:35 -04:00
Locker537
b31a4399c7 Remove trailing whitespace from docs directory. 2012-08-16 17:08:57 -04:00
Locker537
b9d3ce2e10 Change variable '_r' to 'bad_r' to avoid confusion about Python's private variable convention. 2012-08-16 16:50:01 -04:00
Locker537
ff55d737d5 Change variable '_r' to 'r' for consistency. 2012-08-16 16:27:31 -04:00
Lucian Branescu Mihaila
57b4d39749 Remove exception eating from dispatch_hook. 2012-08-16 17:49:00 +02:00
Cory Benfield
00b4ca3b74 Don't get hung up on ports in proxies. 2012-08-15 18:16:27 +01:00
Kenneth Reitz
4130cf9b40 Merge pull request #774 from Lukasa/develop
Throw clear exceptions
2012-08-13 14:14:19 -07:00
Cory Benfield
79d53d3b8a Throw InvalidURL not UnicodeError on bad label. 2012-08-13 21:18:56 +01:00
Cory Benfield
e08b853a0c Test for throwing useful exception on bad label. 2012-08-13 21:18:56 +01:00
Kenneth Reitz
27b55a74d7 Merge pull request #746 from jkbr/develop
Fixed encoding of fields with the same name, multipart/form-data fixes.
2012-08-10 23:30:21 -07:00
Jakub Roztocil
88c762e256 Fixed tests for Python 3 (text vs. bytes). 2012-08-11 08:19:35 +02:00
Jakub Roztocil
dee3693ea0 Use BytesIO for bytes.
This fixes a TypeError on Python 3 that ocurred when passing
bytes as the values for files.
2012-08-10 19:49:03 +02:00
Jakub Roztocil
cfa627ae62 Fixed encoding of fields with the same name.
* Properly handle repeated data fields for multipart/form-data requests (#737)
* Allow a list of 2-tuples as the `files` agument.
* Consistently serialize lists a of parameters (#729).
2012-08-10 19:49:03 +02:00
Kenneth Reitz
64646182b2 Merge pull request #772 from Lukasa/develop
First pass at documenting encodings and RFC compliance.
2012-08-10 09:05:08 -07:00
Kenneth Reitz
56b01bf0e6 Merge pull request #773 from randomir/develop
Tests: python2.6 compat (`assertIn` new in python2.7)
2012-08-10 09:03:09 -07:00
Radomir Stevanovic
4da4792844 tests: python2.6 compat (assertIn added in 2.7) 2012-08-10 17:51:01 +02:00
Cory Benfield
7a9419ce35 Document encodings and RFC compliance. 2012-08-10 14:47:13 +01:00
Kenneth Reitz
40ba6b4ec1 new button domain 2012-08-08 23:31:30 -05:00
Kenneth Reitz
a65e8b4a22 Merge pull request #767 from stefanp/develop
Wrap socket.error in ConnectionError (+ unit tests)
2012-08-08 13:23:10 -07:00
Kenneth Reitz
d4f7d67655 Merge pull request #766 from Lukasa/develop
Accept objects with string representations as URLs.
2012-08-08 13:18:39 -07:00
Stefan Praszalowicz
875c9e18ab Wrap socket.error in ConnectionError (+ unit tests) 2012-08-08 11:12:32 -07:00
Cory Benfield
6166ba7e13 Accept objects with string representations as URLs. 2012-08-08 13:33:25 +01:00
Cory Benfield
e624ae8aea Add test for Issue #423. 2012-08-08 13:33:25 +01:00
Ian Cordasco
ceec572cb9 Merge branch 'develop' into key_val_lists
Conflicts:
    requests/models.py
2012-08-07 12:11:15 -04:00
Kenneth Reitz
bc7b2f9a67 Merge pull request #764 from slingamn/regressions
test and fix regressions from #760
2012-08-06 16:13:59 -07:00
Shivaram Lingamneni
291859c199 fix the tests for python 3 2012-08-06 16:11:45 -07:00
Shivaram Lingamneni
000c105303 propagate self.prefetch on redirect
fixes RequestsTestSuite.test_prefetch_redirect_bug
2012-08-06 15:55:52 -07:00
Shivaram Lingamneni
030ead9c36 properly handle send(prefetch=False)
fixes RequestsTestSuite.test_prefetch_return_response_interaction
2012-08-06 15:55:52 -07:00
Shivaram Lingamneni
857d8eda3a red tests derived from @dhagrow's examples in #760 2012-08-06 15:53:48 -07:00
Kenneth Reitz
a94fcb87d2 Merge pull request #762 from Lukasa/develop
Correctly handle encoding numbers when POSTing.
2012-08-06 14:05:21 -07:00
Cory Benfield
55bf436f8f Correctly handle encoding numbers when POSTing. 2012-08-06 17:40:27 +01:00
Kenneth Reitz
fc6ddfd78a v0.13.6 2012-08-06 02:45:52 -04:00
Kenneth Reitz
b13c24d7b9 Merge pull request #760 from slingamn/fix_leak.release
address connection leak issue from #520
2012-08-05 21:38:12 -07:00
Shivaram Lingamneni
3c0b94047c address connection leak issue from #520
* prefetch now defaults to True, ensuring that by default, sockets
  are returned to the urllib3 connection pool on request end
* sessions now have a close() method, notifying urllib3 to close pooled
  connections
* the module-level API, e.g., `requests.get('http://www.google.com')`,
  explicitly closes its session when finished

When prefetch is False, the open socket becomes part of the state of the
Response object, and it's the client's responsibility to read the whole
body, at which point the socket will be returned to the pool.
2012-08-05 21:09:13 -07:00
Ian Cordasco
1722f28971 Add to_key_val_lists to avoid repetition.
It uses the same logic whenever we're trying to use a list of key values and
avoid what I had started doing -- using the same pattern everywhere.

proxies, and headers should both be covered by this commit.
2012-08-05 23:29:10 -04:00
Ian Cordasco
d82d124152 Merge branch 'develop' into key_val_lists 2012-08-05 16:59:24 -04:00
Kenneth Reitz
1898077f79 Merge pull request #758 from volker48/develop
Develop
2012-08-04 08:39:25 -07:00
Marcus McCurdy
f60579ddda Moved fix for #747 to compat module 2012-08-04 09:35:32 -04:00
Marcus McCurdy
2d321b22b7 Merge branch 'develop' of https://github.com/volker48/requests into develop 2012-08-03 23:18:31 -04:00
Marcus McCurdy
493ea93469 Fixed issue #747
Bound the name builtin_str to __builtin__.str and added another check
for this class since the str class was rebound to unicode in compat.
This issue was only for Python 2 as well.
2012-08-03 23:13:17 -04:00
Marcus McCurdy
2110f7d18c Fixed test for issue #747 to check for '' instead of 'text/plain' 2012-08-03 23:05:37 -04:00
Ian Cordasco
2d5e38f30a params now accepts a k/v list.
Also added test for params accepting k/v lists.
2012-08-03 22:24:52 -04:00
Marcus McCurdy
12328d6e58 Added a test to expose issue #747 2012-08-03 20:09:56 -04:00
Kenneth Reitz
b5ca4b4430 Merge pull request #754 from sigmavirus24/develop
Fix raise_for_status()
2012-08-03 09:21:28 -07:00
Ian Cordasco
644c6f9134 Merge branch 'develop' into key_val_lists 2012-08-03 12:02:01 -04:00
Ian Cordasco
b4bc76f8eb Fix raise_for_status() 2012-08-03 11:42:36 -04:00
Ian Cordasco
5ff165a1e2 Better handling of invalid files.
I stole the idea from _encode_params in all candor.
2012-08-02 17:31:30 -04:00
Ian Cordasco
1efd06a87d This simplification should work.
Probably should write a test case where it should fail though.
2012-08-02 17:31:30 -04:00
Ian Cordasco
46b6207f05 Fix python3 errors. 2012-08-02 17:31:30 -04:00
Ian Cordasco
c71f48b5f1 Some pyflakes fixes.
They were just bothering me far too much with vim+syntastic.
2012-08-02 17:31:30 -04:00
Ian Cordasco
2b33bc289f Tests written for _encode_files new capability.
Work on issue #179
2012-08-02 17:31:30 -04:00
Ian Cordasco
42ddc4c9e8 Need to write tests but this looks good so far. 2012-08-02 17:31:30 -04:00
Kenneth Reitz
664880db62 Merge pull request #751 from Lukasa/develop
Catch socket.gaierror in safe mode.
2012-08-02 13:53:05 -07:00
Kenneth Reitz
22179c493e Merge pull request #753 from berkerpeksag/if-statements
Refactoring in |raise_for_status| method.
2012-08-02 13:52:36 -07:00
Berker Peksag
204649521b Refactoring in |raise_for_status| method.
- Simplified the if statements.
- Remove duplicate code.
2012-08-02 23:45:06 +03:00
Kenneth Reitz
54842cdca9 Merge pull request #752 from anentropic/patch-1
file posting example looked wrong
2012-08-02 04:59:38 -07:00
anentropic
fdec88de99 example looked wrong
From what I can tell from the source code (down thru urllib3) the key in the `files` dict is always the 'fieldname', while specifying a custom filename is optional.

So in this example it is confusing to have a fieldname of 'report.xls' (the filename) where all the other examples use a fieldname of 'file'.
2012-08-02 13:56:12 +02:00
Cory Benfield
4f40b3befc Catch socket.gaierror in safe mode. 2012-08-02 12:16:41 +01:00
Kenneth Reitz
b47418533a Merge pull request #744 from tax/develop
Set content type before authentication
2012-07-30 18:13:17 -07:00
Kenneth Reitz
758cd24033 donate 2012-07-28 17:07:53 -04:00
Kenneth Reitz
027effd585 Merge remote-tracking branch 'origin/develop' into develop 2012-07-28 16:56:49 -04:00
Kenneth Reitz
ca7ee68656 setup.py 2012-07-28 16:56:14 -04:00
Kenneth Reitz
72f7cbfdc1 gittip 2012-07-28 16:56:00 -04:00
Paul
5e175ef24c Set content type before authentication
AWS S3 authentication adds content type header (when it exist) to
canonical string that is signed. Since it is set after authentication
is done authentication on S3 fails
2012-07-27 19:18:13 +08:00
Cory Benfield
02dcc40acd Failing test for Issue #737. 2012-07-27 09:49:39 +01:00
Kenneth Reitz
9abc9ad1b3 v0.13.5 2012-07-27 03:23:33 -04:00
Kenneth Reitz
767751599e v0.13.4 2012-07-27 02:21:56 -04:00
Kenneth Reitz
82d343fa00 disable tricky tests 2012-07-27 02:18:31 -04:00
Kenneth Reitz
e0fed46561 Solves #722 2012-07-27 01:48:25 -04:00
Kenneth Reitz
d74d61e97e changes 2012-07-27 01:40:09 -04:00
Kenneth Reitz
81207783a2 Merge remote-tracking branch 'origin/develop' into develop 2012-07-27 01:39:21 -04:00
Kenneth Reitz
c65065177f ordered dict 2012-07-27 01:39:17 -04:00
Kenneth Reitz
bc63617da2 Merge pull request #647 from mkomitee/kerberos
Implement GSSAPI/Kerberos authentication for requests
2012-07-26 22:36:41 -07:00
Kenneth Reitz
31e768f134 Merge pull request #729 from vickimo/issue_661
Added needed cast for when POSTing data and files (Issue #661)
2012-07-26 22:33:51 -07:00
Kenneth Reitz
e02fb2eb6c urllib update and junks 2012-07-27 01:32:01 -04:00
Kenneth Reitz
0d9ab27b02 Merge pull request #736 from Lukasa/develop
Make OAuth path hack platform independent.
2012-07-26 22:29:58 -07:00
Kenneth Reitz
0af7ca7b27 Merge pull request #739 from saevarom/develop
Appengine workaround
2012-07-26 22:29:17 -07:00
Sævar Öfjörð Magnússon
350be4a549 Appengine workaround 2012-07-25 16:06:26 +00:00
Cory Benfield
55237ad67d Comment typo fix and move newline. 2012-07-25 13:24:38 +01:00
Kenneth Reitz
52b55ccfbc Merge pull request #734 from doismellburning/verbose_http_errors
Include response.reason in raised HTTPErrors
2012-07-24 06:46:34 -07:00
Cory Benfield
79aa9edde1 Make OAuth path hack platform independent. 2012-07-21 18:11:00 +01:00
Kristian Glass
c485928a9f Include reason rather than content in raised HTTPErrors
See https://github.com/kennethreitz/requests/pull/733 for details, TL;DR
content is too free-form for this to generally be a good idea.
2012-07-20 19:26:08 +01:00
Kristian Glass
6eb1ac4452 Include response.content in raised HTTPErrors 2012-07-20 18:50:04 +01:00
Kenneth Reitz
876e1744b1 Merge pull request #731 from jorjun/patch-1
breaks under python 2.7, without the from __future__ import
2012-07-18 07:44:37 -07:00
jorjun
2c241d2801 breaks under python 2.7, without the from __future__ import 2012-07-18 12:58:55 +02:00
Kenneth Reitz
73815e2ed0 Merge pull request #727 from vickimo/issue_547
Fix infinite loop on wrong Digest Authentication (Issue #541 and #547)
2012-07-14 15:48:07 -07:00
Victoria Mo
f9c0ddf46d Added needed cast for when POSTing data and files (Issue #661)
Co-Authored By: Timnit Gebru <tgebru@gmail.com>
Co-Authored By: Sarah Gonzalez <smar.gonz@gmail.com>
Co-Authored By: Leila Muhtasib <muhtasib@gmail.com>
2012-07-14 18:28:34 -04:00
Victoria Mo
5296b8be90 Fix infinite loop on wrong Digest Authentication (Issue #547)
Modified code to use the current fix versus the old fix, which was broken.

Co-Authored By: Timnit Gebru <tgebru@gmail.com>
Co-Authored By: Sarah Gonzalez <smar.gonz@gmail.com>
Co-Authored By: Leila Muhtasib <muhtasib@gmail.com>
2012-07-14 16:09:13 -04:00
Kenneth Reitz
a97a513390 Merge pull request #725 from muhtasib/Timeout_Fix
Differentiate between two types of timeout errors from urllib3
2012-07-13 13:49:12 -07:00
Leila Muhtasib
318f2460ee Differentiate between two types of timeout errors from urllib3
Bubble up error message from urllib3 to indicate to user
whether error was a socket timeout vs a no connections
available in connection pool error.

Co-Authored By: Sarah Gonzalez
2012-07-13 15:20:05 -04:00
Kenneth Reitz
c3ab38ed6f Merge pull request #721 from karlcow/develop
adding clarification to the history API.
2012-07-12 14:13:36 -07:00
karl
9fe4a99365 adding clarification to the history API. It was not clear how the history list was sorted. 2012-07-12 16:34:28 -04:00
Kenneth Reitz
884fc333a1 makin' history 2012-07-12 13:18:35 -07:00
Kenneth Reitz
902d174d21 v0.13.3 2012-07-12 13:12:54 -07:00
Kenneth Reitz
b222ff9477 Merge branch 'develop' of git://github.com/siebenschlaefer/requests into develop
Conflicts:
	AUTHORS.rst
2012-07-12 12:06:43 -07:00
Kenneth Reitz
baa2355e4e Merge pull request #717 from ms4py/patch-2
Updated documentation
2012-07-12 00:28:59 -07:00
Marc Schlaich
ea99d5e0d9 This shouldn't be here anymore. 2012-07-12 10:22:12 +03:00
Kenneth Reitz
23aa6c44a9 Merge pull request #715 from Lukasa/develop
Do not hide SSLErrors behind Timeouts.
2012-07-12 00:09:21 -07:00
Cory Benfield
523906c54f Do not hide SSLErrors behind Timeouts. 2012-07-11 17:31:59 +01:00
Kenneth Reitz
c19ff0388e Merge pull request #714 from muhtasib/develop
Documentation Update
2012-07-10 15:48:07 -07:00
muhtasib
6413c063ed Fix minor formatting issue. 2012-07-10 19:34:29 -03:00
Leila Muhtasib
051d3bb601 Updated documentation for SSL client cert usuage.
Co-Authored By: Timnit Gebru <tgebru@gmail.com>
Co-Authored By: Sarah Gonzalez <smar.gonz@gmail.com>
Co-Authored By: Victoria Mo <vm2355@columbia.edu>
2012-07-10 18:25:32 -04:00
Matthias Rahlf
08cebb3c2f fixed param handling in Request.full_url 2012-07-10 01:06:02 +02:00
Kenneth Reitz
b7fd0e81fd Merge pull request #709 from dstufft/develop
Have User Agent include more details
2012-07-08 00:42:17 -07:00
Donald Stufft
21f60fe8df Move the user agent generation into it's own utility function 2012-07-08 00:47:24 -04:00
Donald Stufft
523433f26c Readd default that was accidently removed 2012-07-08 00:37:23 -04:00
Kenneth Reitz
c089993a0f #710 2012-07-08 00:27:26 -04:00
Kenneth Reitz
f8c98715c3 simplify #710 2012-07-08 00:24:24 -04:00
Kenneth Reitz
3347146a44 merge conflict 2012-07-08 00:23:36 -04:00
Kenneth Reitz
6b7f23f9f0 Merge pull request #710 from zachwill/develop
Add try/catch for simplejson vs json
2012-07-07 21:21:54 -07:00
Zach Williams
25299400fa Add try/catch for simplejson vs json 2012-07-07 21:14:29 -07:00
Donald Stufft
11433d942d Include the system name and version in the default user agent 2012-07-07 16:13:39 -04:00
Donald Stufft
982268a201 Include the implementation and implementation version number in the default User-Agent 2012-07-07 16:08:22 -04:00
Kenneth Reitz
4832db0b11 Merge remote-tracking branch 'origin/master' 2012-07-06 02:54:12 -04:00
Kenneth Reitz
64ec73cbda kippt 2012-07-06 02:54:08 -04:00
Kenneth Reitz
808b0ad8cd Merge pull request #703 from westonplatter/develop
made the develop README.rest TravisCI PNG link to TravisCI project status page
2012-07-02 04:31:09 -07:00
Kenneth Reitz
0db58430ca Merge pull request #705 from westonplatter/master
travis ci png linked
2012-06-30 18:07:27 -07:00
Weston Platter
81e86a35fe made the master README.rst TravisCI PNG clickable to TravisCI status page 2012-06-30 18:35:48 -04:00
Weston Platter
0512132b91 made the TravisCI PNG link to TravisCI project status page 2012-06-30 18:33:40 -04:00
Weston Platter
32bcd4b3bf made the TravisCI PNG clickable to TravisCI status page 2012-06-30 18:22:22 -04:00
Kenneth Reitz
d983cfabe2 syntax error 2012-06-28 17:35:07 -07:00
Kenneth Reitz
254adf9dc8 version-dependent package includes 2012-06-28 17:33:57 -07:00
Kenneth Reitz
ef5e5a1a21 Merge remote-tracking branch 'origin/develop' into develop 2012-06-28 17:29:30 -07:00
Kenneth Reitz
fb2ce4f0dc v0.13.2 2012-06-28 17:29:22 -07:00
Kenneth Reitz
065caa30f4 Merge pull request #629 from saschpe/develop
Add openSUSE certificate support
2012-06-28 17:26:30 -07:00
Kenneth Reitz
a1fd038d2c vendored oauthlib 2012-06-28 17:20:26 -07:00
Kenneth Reitz
78d6d31697 oauthlib license 2012-06-28 16:24:06 -07:00
Kenneth Reitz
9576518d69 oauthlib 2012-06-28 16:23:25 -07:00
Kenneth Reitz
6541ceb5f5 Merge remote-tracking branch 'origin/develop' into develop 2012-06-28 16:00:40 -07:00
Kenneth Reitz
35f6671ec5 new vendored libs 2012-06-28 16:00:34 -07:00
Kenneth Reitz
a17fdf6224 chardet2 2012-06-28 16:00:00 -07:00
Kenneth Reitz
abf33ba11c chardet2 2012-06-28 15:58:12 -07:00
Kenneth Reitz
c3ad7af06c include certifi 2012-06-28 15:58:00 -07:00
Kenneth Reitz
1253c78011 embed chardet 2012-06-28 12:53:39 -07:00
Kenneth Reitz
8309ac72da Merge pull request #693 from sigmavirus24/develop
Fix Response Status Codes in the docs.
2012-06-25 17:57:02 -07:00
Kenneth Reitz
5dc68d0070 Merge pull request #696 from koordinates/develop
client certificates are ignored when verify=False
2012-06-25 17:56:44 -07:00
Craig de Stigter
74a4d06d58 fix a bug where client certificates never get set unless verify=True (which verifies server certs, so should be unrelated) 2012-06-26 12:42:14 +12:00
Kenneth Reitz
8f0ac668da update urllib3 2012-06-25 12:35:39 -04:00
Ian Cordasco
3aa7f24e74 Fix Response Status Codes in the docs. 2012-06-21 15:06:01 -04:00
Kenneth Reitz
64da351ed9 Merge pull request #684 from gulopine/develop
Sign querystring parameters in OAuth 1.0
2012-06-20 16:52:38 -07:00
Kenneth Reitz
da35675c17 Merge pull request #690 from Lukasa/develop
Temporary fix for unicode literal breaking test.
2012-06-19 11:04:04 -07:00
Cory Benfield
f8076fee5e Temporary fix for unicode literal breaking test. 2012-06-19 18:36:35 +01:00
Kenneth Reitz
bcf04d5e93 Merge pull request #686 from Lukasa/develop
Fix failing setup.py
2012-06-19 06:28:57 -07:00
Cory Benfield
80ceaa47da Remove mimetools_choose_boundary from setup.py.
This package is not present in the source, was removed in commit
d3acb783b9 during an update of urllib3.
2012-06-19 12:31:40 +01:00
Marty Alchin
4e568c1899 Sign querystring parameters in OAuth 1.0
Existing usage doesn't pass GET querystring parameters along to oauthlib,
so it wasn't signing those properly, which causes problems with APIs that
rely heavily on GET parameters. By passing in r.full_url instead of r.url,
oauthlib can parse out the correct parameters and sign them properly.
2012-06-18 21:02:51 -07:00
Kenneth Reitz
38db8c2109 Merge pull request #683 from jkleint/patch-1
Update quickstart docs raise_for_status() exception output.
2012-06-18 13:33:00 -07:00
jkleint
234a55da6a Update raise_for_status() exception output to reflect that requests.exceptions.HTTPError is raised, not urllib2.HTTPError. 2012-06-18 17:26:42 -03:00
Kenneth Reitz
f178219d45 Merge pull request #680 from mahmoudhossam/develop
Add rauth.
2012-06-16 00:51:26 -07:00
Mahmoud Hossam
5cc2129c73 Add rauth. 2012-06-16 10:36:18 +03:00
Kenneth Reitz
8de9b2e149 makin' history 2012-06-15 14:37:51 -04:00
Kenneth Reitz
c7514faf4a add response.reason
#588
2012-06-15 14:37:33 -04:00
Kenneth Reitz
f5d1d0d27a Merge remote-tracking branch 'origin/develop' into develop 2012-06-15 14:31:24 -04:00
Kenneth Reitz
d3acb783b9 urllib3 update
fixes #664
2012-06-15 14:31:19 -04:00
Sascha Peilicke
66ef8886c6 Add openSUSE certificate support 2012-06-15 14:16:16 +02:00
Kenneth Reitz
08ac9897bb Merge pull request #675 from gulopine/develop
Make sure OAuth doesn't fall off
2012-06-14 10:18:23 -07:00
Kenneth Reitz
6b1e81c410 cleanup #676 2012-06-14 12:51:28 -04:00
Kenneth Reitz
511b1391b4 Merge pull request #676 from apotheos/develop
Additional Documentation for Requests and Responses
2012-06-14 09:50:40 -07:00
Michael Holler
87637c9bae Merge branch 'develop' of github.com:apotheos/requests into develop 2012-06-14 09:15:18 -05:00
Michael Holler
5db661a9e4 Removed last attempt at documenting how to access Request from Response objects, replaced with section entitled 'Request and Response Objects' 2012-06-14 09:14:37 -05:00
Michael Holler
8b9f1b36bd Removed last attempt at documenting how to access Request from Response objects, replaced with section entitled 'Request and Response Objects' 2012-06-14 09:09:58 -05:00
Michael Holler
fde7ba78f2 Added 'request object attributes' section header 2012-06-13 23:18:25 -05:00
Michael Holler
b0db8cf2d8 Added alphabetized list of request attributes and descriptions. 2012-06-13 23:16:06 -05:00
Michael Holler
a5f05353b3 Added documentation on how to access and use the Request object. 2012-06-13 23:00:12 -05:00
Marty Alchin
9a30e02962 Make sure OAuth doesn't fall off, which happens in particular when encountering redirects 2012-06-13 20:54:54 -07:00
Kenneth Reitz
1d1931333a Merge pull request #670 from piotr-dobrogost/#669
Fixes issue #669
2012-06-10 06:37:07 -07:00
Piotr Dobrogost
8d75cdf7fe Fixes issue #669
NamedTemporaryFile was being automatically deleted on Windows thus
couldn't be opened later for reading
2012-06-10 15:27:54 +02:00
Kenneth Reitz
f413d0ebcc Merge pull request #668 from ig0774/patch-1
Send the original response url to `urlparse` rather than the `Response` object
2012-06-09 04:30:19 -07:00
ig0774
98b8316c0c Send the original response url to urlparse rather than the Response object. urlparse cannot handle Response objects. 2012-06-08 09:35:54 -03:00
Kenneth Reitz
f733ff0196 don't change scrollbars 2012-06-07 22:44:38 -04:00
Kenneth Reitz
10d2398173 fix test for python3 2012-06-07 22:21:06 -04:00
Kenneth Reitz
32941fdd20 Merge remote-tracking branch 'origin/develop' into develop 2012-06-07 22:09:16 -04:00
Kenneth Reitz
7c2306baec v0.13.1 2012-06-07 22:09:01 -04:00
Kenneth Reitz
404585ce8c += AUTHORS #659 2012-06-07 22:07:26 -04:00
Kenneth Reitz
78eecd7d7e Merge pull request #659 from Bluehorn/develop
Allow passing a file or file-like object as data.
2012-06-07 19:06:49 -07:00
Kenneth Reitz
fadcf799de fix unicode literal for python 3 2012-06-07 21:58:52 -04:00
Kenneth Reitz
8bfbfdfc79 Merge remote-tracking branch 'origin/develop' into develop 2012-06-07 21:55:11 -04:00
Kenneth Reitz
843672f4fe make empty body text responses work
#660
2012-06-07 21:55:07 -04:00
Kenneth Reitz
e8f3fc33bb test that empty body text responses work 2012-06-07 21:54:45 -04:00
Kenneth Reitz
89266f9062 Merge pull request #665 from dalanmiller/patch-2
If requests.async has been removed, the docs should point people to the right place.
2012-06-07 16:55:06 -07:00
Daniel Miller
c589d8a251 If this comment is true (https://github.com/kennethreitz/requests/issues/239#issuecomment-6180706), then it would be good to point people in the right direction. Otherwise disregard this message. 2012-06-07 16:47:54 -07:00
Torsten Landschoff
f0e327f979 Allow passing a file or file-like object as data.
The underlying httplib already allows passing an open file object as body
to its HTTPConnection.request method. I think requests should allow that
as well.
2012-06-07 10:13:40 +02:00
Kenneth Reitz
c0ae3dd31e more examples
#657
2012-06-07 03:09:19 +02:00
Kenneth Reitz
dda9689ca4 Revert "In fact, the feature is so awesome that it should go into index.rst"
This reverts commit f968fe0136.
2012-06-07 03:02:32 +02:00
Danilo Bargen
f968fe0136 In fact, the feature is so awesome that it should go into index.rst 2012-06-06 17:07:42 +02:00
Danilo Bargen
1164450dac Added r.json documentation (document ALL the awesome features!) 2012-06-06 16:59:20 +02:00
Kenneth Reitz
aa42318395 v0.13.1 2012-06-05 10:25:08 +02:00
Kenneth Reitz
488a51d619 Revert "Auto-detect CA Cert path instead of requiring users to hack setup.py"
This reverts commit 62a23bfbde.
2012-06-05 00:51:46 +02:00
Kenneth Reitz
12e5f3855c Merge pull request #651 from urbanairship/detect-cacerts
Auto-detect CA Cert path instead of requiring users to hack setup.py
2012-06-04 15:24:14 -07:00
Michael Schurter
62a23bfbde Auto-detect CA Cert path instead of requiring users to hack setup.py
Also fixed nearby comments to wrap at 79 characters as per PEP8
2012-06-04 13:19:10 -07:00
Kenneth Reitz
b026def961 Merge pull request #646 from mkomitee/hooks
Allowing hooks to return responses that indicate errors
2012-06-04 07:44:56 -07:00
Michael Komitee
c803e3af55 Implement GSSAPI/Kerberos authentication for requests
Currently has two issues which may be related:
- doesn't work with redirects, we try to authenticate the server a second
  time with a fully completed kerberos context.
- 403 responses result in the wrong response object being returned, but
  this is also true for http digest authentication due to a bug in hook
  handling in general.
2012-06-01 17:15:53 -04:00
Michael Komitee
662c3edacc Allowing hooks to return responses that indicate errors
Since response objects for failures (4xx/5xx responses) evaluate to False
in a boolean context, any hook which returns such a failure response will
evaluate to False.

The way hooks were setup, any failure response resulting from a hook would
be ignored, and the initial response before it got processed by the hook
would be substituted in its place. This commit changes that logic to test
for None so that hooks that return failures can do so.
2012-06-01 16:05:22 -04:00
Kenneth Reitz
355b97165c Merge pull request #643 from gwrtheyrn/docs_proxy_auth
Added information about HTTP proxy authentication to docs
2012-05-30 12:48:33 -07:00
Danilo Bargen
d81dfe266e Added information about HTTP proxy authentication to docs 2012-05-30 17:34:24 +02:00
Kenneth Reitz
77a57c0e7e v0.13.0 2012-05-29 20:53:51 -04:00
Kenneth Reitz
a291d0d0f8 whitespace 2012-05-29 20:53:13 -04:00
Kenneth Reitz
617091e747 v0.13.0 2012-05-29 20:52:58 -04:00
Kenneth Reitz
cb15310d6a by @mwielgoszewski 2012-05-29 19:54:40 -04:00
Kenneth Reitz
1c0abbd74b cleanup #633 2012-05-29 19:53:22 -04:00
Kenneth Reitz
7813bd8ac0 Merge pull request #633 from tzuryby/develop
poor man's patch for issue #630
2012-05-29 16:51:48 -07:00
Kenneth Reitz
ad8205f930 Merge pull request #619 from Lukasa/develop
Rewrite quickstart docs.
2012-05-29 16:49:51 -07:00
Kenneth Reitz
f9dd485582 Merge pull request #640 from JuhaS/patch-1
Small correction on a comment.
2012-05-29 16:45:54 -07:00
Kenneth Reitz
d0f309b947 Merge pull request #638 from mher/develop
no_proxy support
2012-05-29 16:44:56 -07:00
Kenneth Reitz
400b4567f0 Merge pull request #632 from amalakar/develop
Issue #505: Changed the store_cookie configuration to be part of the conig dict, instead of being a new argument
2012-05-29 16:41:39 -07:00
JuhaS
ba4cc326c2 Small correction on a comment. 2012-05-28 16:28:31 +03:00
Mher Movsisyan
cb8f9756e3 Fixes python3 compatibility issue 2012-05-28 14:11:59 +05:00
Mher Movsisyan
b8561cda5e no_proxy support 2012-05-27 22:21:26 +05:00
Tzury Bar Yochay
7125fe5554 this try catch is a poor man's patch for issue #630 see https://github.com/kennethreitz/requests/issues/630 2012-05-24 06:17:21 +03:00
Arup Malakar
4a30979622 Change the None check from self.assertIsNone to python style None Check, as build was failing 2012-05-23 14:25:54 -07:00
Arup Malakar
b28673368b Issue #505: Changed the store_cookie configuration to be part of the config dict, instead of being a new argument 2012-05-23 14:12:18 -07:00
Kenneth Reitz
de1637c3de Merge pull request #626 from joshimhoff/develop
Improvements to RequestsCookieJar
2012-05-21 21:45:44 -07:00
Josh Imhoff
0eb0b89431 Removed print statements left over from debugging. 2012-05-21 20:27:47 -04:00
Josh Imhoff
96cd8e9ca0 Wrote tests for new CookieJar functionality and made them pass. 2012-05-21 20:14:12 -04:00
Josh Imhoff
9f26d0ced3 In cookies.py, CookieConflictError is now thrown if there is more than one cookie with same name. 2012-05-21 18:21:12 -04:00
Josh Imhoff
b7d0925d6b Docstrings and bug fixes in cookies.py 2012-05-21 17:59:38 -04:00
Cory Benfield
2b8e01bff7 First draft of full verbs. 2012-05-19 21:34:36 +01:00
Josh Imhoff
686db5d452 Defined keys(), values(), and items() in order to support dict-like client interface. Now, we throw exceptions if __getitem__() or __setitem__() is used when multiple domains are in jar. 2012-05-18 00:48:59 -04:00
Cory Benfield
36fd8da1c0 Correctly reflect redirection behaviour.
The docs incorrectly listed HEAD as a method that follows redirects by
default: it does not. This commit resolves this issue, and thus resolves
issue #504.
2012-05-17 19:25:35 +01:00
Cory Benfield
45506d1f39 Rewrite quickstart docs.
This should help with issue #503.
2012-05-17 10:16:42 +01:00
Kenneth Reitz
2d9746621a Merge pull request #617 from mwielgoszewski/develop
Expose case-insensitive key access when deleting a key from CaseInsensitveDict
2012-05-16 17:34:02 -07:00
Kenneth Reitz
3c14435109 fix test for 2.6's unittest 2012-05-16 17:13:55 -07:00
Kenneth Reitz
4cf31b0b86 authors 2012-05-16 17:09:43 -07:00
Arup Malakar
c501784541 Issue #505: Allow disabling of cookie persistence/sending 2012-05-16 15:07:15 -07:00
Marcin Wielgoszewski
4b7c5dab0e Expose case-insensitive key access when deleting a key from CaseInsensitiveDict 2012-05-16 13:58:51 -04:00
Kenneth Reitz
c477f6eb6f Merge pull request #562 from slingamn/urandom
replace utils.randombytes with os.urandom
2012-05-15 22:49:27 -07:00
Shivaram Lingamneni
f25827c5b6 replace utils.randombytes with os.urandom 2012-05-15 15:42:03 -07:00
Kenneth Reitz
355003b400 Merge pull request #614 from ib-lundgren/multipart_fix
Better content-type detection and unicode fix
2012-05-15 08:39:20 -07:00
Ib Lundgren
6a9d59ea97 Unicode fix for py3 2012-05-15 17:37:15 +02:00
Kenneth Reitz
2f50cb92b6 Merge pull request #613 from surajbarkale/patch-1
Remove sharing of base_headers config between sessions.
2012-05-15 08:31:43 -07:00
Ib Lundgren
c24665b593 Better content-type detection and unicode fix 2012-05-15 17:20:01 +02:00
Suraj Barkale
973e9cb548 Remove sharing of base_headers config between sessions.
Since base_headers is a dictionary, it's reference was shared with all instances of
Session objects. Using deepcopy here should not incur large performance penalty.
2012-05-15 19:47:02 +05:30
Kenneth Reitz
763393f70a Merge pull request #611 from pnasrat/develop
Improve developer documentation.
2012-05-13 19:47:19 -07:00
Paul Nasrat
2c11473816 Improve developer documentation.
I cloned, followed the todo and had failures as no certifi or chardet.

Fixed up so easy to get started.
2012-05-13 16:09:52 -07:00
Kenneth Reitz
40d325366b Merge pull request #610 from medwards/whitespace
Removed extra whitespace
2012-05-13 11:01:22 -07:00
Michael Edwards
51f7628078 Removed extra whitespace 2012-05-13 11:59:31 +02:00
Kenneth Reitz
4161a7ec6a Merge pull request #607 from ztest/develop
Fix a docstring typo (of -> if).
2012-05-12 14:23:04 -07:00
ztest
ed767cb703 Fix a docstring typo (of -> if). 2012-05-12 13:09:14 -04:00
Shivaram Lingamneni
0442122d34 remove unused import 2012-05-10 15:14:44 -07:00
Kenneth Reitz
327b9eab87 semver 2012-05-10 17:11:35 -05:00
Kenneth Reitz
3ee594140b remove oreos 2012-05-10 17:10:47 -05:00
Kenneth Reitz
15694fa2f7 remove gevent extras_require 2012-05-10 17:09:53 -05:00
Kenneth Reitz
07f6675376 remove requests async tests 2012-05-10 17:02:22 -05:00
Kenneth Reitz
32327f8f7c remove requests.async 2012-05-10 17:01:09 -05:00
Kenneth Reitz
a050faf084 makin' history 2012-05-10 13:10:50 -05:00
Kenneth Reitz
0a37d82444 Merge pull request #603 from benmao/develop
get cookie like dict, such as s.cookies.get('test', 'no cookie')
2012-05-10 11:07:00 -07:00
Kenneth Reitz
3d2d072927 Merge pull request #604 from joshimhoff/develop
New implementation of safe_mode.
2012-05-10 11:06:24 -07:00
ben
44663b5e8e get cookie like dict, such as self.cookies.get('test', 'no cookie') 2012-05-10 22:17:23 +08:00
Josh Imhoff
db43eb4cb9 Now, safe_mode will catch socket.timeout too. 2012-05-09 15:13:12 -04:00
Josh Imhoff
cff70e75b7 New implementation of safe_mode. Now, we throw exceptions in models.py regardless of safe_mode. We catch those exceptions at the API level and return a blank Response. See safe_mode.py for details. 2012-05-09 14:47:29 -04:00
Kenneth Reitz
2d328d8a7f Merge pull request #595 from reclosedev/sess-cookies-no-resp
Session cookies not saved when Session.request is called with return_response=False
2012-05-08 08:06:51 -07:00
Roman Haritonov
c010f5895a Add myself to AUTHORS.rst 2012-05-08 14:30:24 +04:00
Roman Haritonov
33f1087584 Move session cookie saving from Session.request() to Request._build_response() 2012-05-08 13:02:39 +04:00
Roman Haritonov
975430d5e6 Test async requests with Session cookies 2012-05-08 12:55:36 +04:00
Roman Haritonov
56ef079e6f Test if cookies are saving to session when session.request is called with return_response=False 2012-05-08 12:17:58 +04:00
Kenneth Reitz
0308a2806a Merge pull request #594 from slingamn/makefile_again
unbreak the Jenkins build again/hopefully :-/
2012-05-07 22:46:00 -07:00
Shivaram Lingamneni
175945b0bd remove the oauthlib trunk from requirements.txt 2012-05-07 22:40:11 -07:00
Shivaram Lingamneni
2ee67441c8 unbreak the Jenkins build (again/hopefully)
Pyflakes is unavailable in the Jenkins Python 3 / PyPy environments
2012-05-07 22:36:51 -07:00
Kenneth Reitz
6fd03d5f20 thread safe 2012-05-08 01:24:30 -04:00
Kenneth Reitz
a3a928c7f1 gah 2012-05-08 01:21:48 -04:00
Kenneth Reitz
bca920c1c1 v0.12.1 2012-05-08 01:18:05 -04:00
Kenneth Reitz
6b09e6ee34 redirects clear files also
Fixes #575
2012-05-08 01:14:17 -04:00
Kenneth Reitz
2a7811bf2f Merge remote-tracking branch 'origin/develop' into develop 2012-05-08 00:58:32 -04:00
Kenneth Reitz
e627c1f8a8 Merge pull request #559 from barberj/issue_526
Issue #526
2012-05-07 21:58:20 -07:00
Kenneth Reitz
fe7348cc53 yay json
fixes #593
2012-05-08 00:57:46 -04:00
barberj
b066902705 adding test verifying data httpbin sees 2012-05-06 19:24:37 -04:00
barberj
64eb415ec0 synatx error for python3. all strings are unicode 2012-05-06 18:50:42 -04:00
barberj
e912a6f5da sending strings to be received as files 2012-05-06 15:14:57 -07:00
barberj
3288426f2b added unicode strings 2012-05-06 15:14:57 -07:00
barberj
0a7d98871c credit where credits due 2012-05-06 15:14:57 -07:00
barberj
ed7b14899f added mutlipart file=strings 2012-05-06 15:14:40 -07:00
Kenneth Reitz
7b6338c4b6 Merge pull request #590 from berkerpeksag/doc-links
Fixed broken links in TODO docs.
2012-05-06 12:54:06 -07:00
Berker Peksag
a0f991dbad Fixed broken links in TODO docs. 2012-05-06 22:26:28 +03:00
Kenneth Reitz
c84012edec Merge pull request #585 from chazapis/develop
Fix out-of-range issue with iter_lines (#515).
2012-05-04 11:49:49 -07:00
Kenneth Reitz
7f571f5e5a Merge pull request #587 from slingamn/jenkins
unbreak the Jenkins build by excluding ./env/*
2012-05-04 11:48:35 -07:00
Shivaram Lingamneni
d4227051a9 unbreak the Jenkins build by excluding ./env/* 2012-05-04 04:45:30 -07:00
Kenneth Reitz
3d373e2a16 Merge pull request #579 from slingamn/pyflakes.release
Changes for #574
2012-05-03 23:29:04 -07:00
Kenneth Reitz
38e6695627 Merge pull request #581 from crodjer/develop
A utility for using environment proxies
2012-05-03 23:28:07 -07:00
Kenneth Reitz
8bd6515564 Merge pull request #582 from slingamn/cookietests.release
Tests for persistent and secure cookies
2012-05-03 23:26:44 -07:00
Shivaram Lingamneni
8fedec785a Tests for persistent and secure cookies 2012-05-03 23:20:37 -07:00
Rohan Jain
7cf6ca80a6 Add myself to authors
Signed-off-by: Rohan Jain <crodjer@gmail.com>
2012-05-04 10:59:57 +05:30
Rohan Jain
abc38cf17f Use utility for environment proxy as fallback
Signed-off-by: Rohan Jain <crodjer@gmail.com>
2012-05-04 10:44:07 +05:30
Rohan Jain
0ba8c44260 A utility function to fetch environment proxies
This adds support for lowercase environment proxy variables (which are
quite popular too). It returns proxies in a format compatible with
request's proxy parameter.
Moreover, it can be used in the request models for proxy defaults.

Signed-off-by: Rohan Jain <crodjer@gmail.com>
2012-05-04 10:44:01 +05:30
Kenneth Reitz
1adaba3865 Merge pull request #580 from slingamn/keepalive
Fix and test for #458
2012-05-03 21:33:42 -07:00
Shivaram Lingamneni
35ec6bb613 fix for #458 2012-05-03 21:16:56 -07:00
Shivaram Lingamneni
3d4d5ab0df test for #458 2012-05-03 21:16:46 -07:00
Shivaram Lingamneni
bcc4125a18 quiet spurious pyflakes errors 2012-05-03 19:59:15 -07:00
Shivaram Lingamneni
7f9ea04286 Various Makefile updates 2012-05-03 19:59:15 -07:00
Kenneth Reitz
317f64a11f Merge pull request #577 from slingamn/redirects_537
Fix and test for #537
2012-05-03 01:36:12 -07:00
Kenneth Reitz
a3e55634d6 Merge pull request #572 from slingamn/chardet_2
cleanup, redux
2012-05-03 01:35:47 -07:00
Shivaram Lingamneni
9bf53676b8 fix crash in safe mode when response.cookies is None 2012-05-03 01:29:12 -07:00
Shivaram Lingamneni
41d1a427b0 add a test for max_redirects in safe/normal modes 2012-05-03 01:29:12 -07:00
Shivaram Lingamneni
853a07112b consistency: .text shouldn't recover from unicode decoding errors, either 2012-05-02 20:21:02 -07:00
Shivaram Lingamneni
a8555d811d remove fancy test assertions that are unavailable on 2.6 2012-05-02 20:21:02 -07:00
Shivaram Lingamneni
538de55607 raise a ValueError if no encoding was sent and chardet is unavailable 2012-05-02 20:21:02 -07:00
Shivaram Lingamneni
57ccd7e65c Have Travis run all tests except the external and async ones
(async is currently unsupported under Python 3)
2012-05-02 20:20:26 -07:00
Kenneth Reitz
a9033912b3 missed import 2012-05-02 19:18:14 -04:00
Kenneth Reitz
373a34a144 date fix 2012-05-02 19:17:14 -04:00
Kenneth Reitz
9324c2a9b4 oauthlib 2012-05-02 19:15:43 -04:00
Kenneth Reitz
fb2931801e v0.12.0 2012-05-02 19:13:19 -04:00
Kenneth Reitz
8ac6b266c9 pre-send hook
#516
2012-05-02 19:09:18 -04:00
Kenneth Reitz
efe5d13ed6 Merge pull request #516 from EnTeQuAk/move_pre_request
Move pre_request to a more usable place, followup to #382
2012-05-02 15:58:08 -07:00
Kenneth Reitz
a9963e3841 upper case automatically 2012-05-02 18:57:06 -04:00
Kenneth Reitz
f1d104e004 making history 2012-05-02 18:56:51 -04:00
Kenneth Reitz
996f99b267 Merge remote-tracking branch 'origin/develop' into develop 2012-05-02 18:47:53 -04:00
Kenneth Reitz
62d2ea8034 default chunk size for .content much bigger 2012-05-02 18:47:50 -04:00
Kenneth Reitz
ed15c70cd0 Merge pull request #573 from idangazit/develop
Lazily encode data, params, files
2012-05-02 14:19:56 -07:00
Idan Gazit
cf6b20429a Merge remote-tracking branch 'upstream/develop' into develop 2012-05-03 00:08:00 +03:00
Idan Gazit
324336e7f6 Lazily encode data, params, files
Previously, data, params, and files were encoded and stored in
Request.__init__, and subsequently put into service during
Request.send. The problem with this approach is that hooks and auth
callables need to be aware of the eager encoding, and if they touch the
originals, make sure to update the encoded versions.

A better approach is to only encode late in the sending process. This
way, hooks and auth callables can safely make changes without fear of
the old, encoded variant overriding it.
2012-05-03 00:04:13 +03:00
Idan Gazit
d240b1fe15 PEP8 Cleanup 2012-05-02 23:16:38 +03:00
Antony Chazapis
c333bd144e Fix out-of-range issue with iter_lines (#515). 2012-05-02 16:51:19 +03:00
Kenneth Reitz
53d60cac4f Revert "Update Makefile and travis configuration to run all (non-external) tests"
This reverts commit a453a78c7c.
2012-05-02 02:38:20 -04:00
Kenneth Reitz
6271046a27 Revert "Cache the value of the Response.text property"
This reverts commit d232948188.
2012-05-02 02:38:11 -04:00
Kenneth Reitz
8a81a437d2 Revert "Use utf-8 as the default encoding"
This reverts commit 35d5ac6e8f.
2012-05-02 02:37:51 -04:00
Shivaram Lingamneni
a453a78c7c Update Makefile and travis configuration to run all (non-external) tests 2012-05-01 23:21:05 -07:00
Shivaram Lingamneni
bdd7f8f8a2 Change setup.py to reflect required/optional dependencies 2012-05-01 23:21:05 -07:00
Shivaram Lingamneni
d232948188 Cache the value of the Response.text property 2012-05-01 22:28:50 -07:00
Shivaram Lingamneni
35d5ac6e8f Use utf-8 as the default encoding
(fixes crashes on failure to import chardet)
2012-05-01 21:46:53 -07:00
Shivaram Lingamneni
fdd08215ea update documentation to correspond to new cookie API 2012-05-01 21:46:53 -07:00
Shivaram Lingamneni
ff7cfa732f restore docs/_build directory to .gitignore 2012-05-01 19:18:55 -07:00
Kenneth Reitz
45be14ed6f Merge pull request #565 from slingamn/cookiejar
Support CookieJar, references #281
2012-05-01 17:22:37 -07:00
Shivaram Lingamneni
11a3eaec26 add Python 3 compatibility 2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
7832f2ae7e add laurentb's test case for cookie handling on redirects 2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
6eb349f5d2 remove unused import in test 2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
ff169d32fe fix and test for a bug dhagrow reported 2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
404ecaf95b clarified documentation from e-mail discussion 2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
1de14e6a93 fix usage of compat.urlparse
(this code path appears to have been exercised only by secure cookies)
2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
492bda1343 add a test for redirection 2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
4d6871d917 Further changes to move cookies to CookieJar 2012-05-01 17:00:19 -07:00
miguel
c4ab96b638 mostly complete cookie support based on cookiejar 2012-05-01 17:00:19 -07:00
miguel
fed6cfbf4d mostly complete cookie support based on cookiejar 2012-05-01 17:00:19 -07:00
miguel
2a27b123fd catch TooManyRedirects in safe_mode 2012-05-01 17:00:19 -07:00
Shivaram Lingamneni
7c5151e8e7 changes to .gitignore 2012-05-01 17:00:19 -07:00
Kenneth Reitz
a189c238cc LOLJK 2012-05-01 07:22:59 -04:00
Kenneth Reitz
d427bb8603 OAUTH ALL THE THINGS 2012-05-01 07:19:04 -04:00
Kenneth Reitz
7eed89a0df v0.11.3 2012-05-01 07:17:35 -04:00
Kenneth Reitz
5d9699bbdc oauthlib only for 2 2012-05-01 07:07:18 -04:00
Kenneth Reitz
e6cce7a5bd syntax errors 2012-05-01 07:06:55 -04:00
Kenneth Reitz
d79e1bbaad or str 2012-05-01 07:02:13 -04:00
Kenneth Reitz
bf1744eea2 hax 2012-05-01 06:57:25 -04:00
Kenneth Reitz
9427e1efe8 missed an import 2012-05-01 06:55:19 -04:00
Kenneth Reitz
661af1dc1a only import oauthlib in python2 2012-05-01 06:54:09 -04:00
Kenneth Reitz
a5bc99d53e no -e 2012-05-01 06:50:38 -04:00
Kenneth Reitz
14fae695bf uh, sure 2012-05-01 06:47:58 -04:00
Kenneth Reitz
be04142723 Revert "Call auth callable before encoding body data"
This reverts commit 9217a2523d.
2012-05-01 06:42:58 -04:00
Kenneth Reitz
748c65f7a7 git+git://github.com/idangazit/oauthlib.git 2012-05-01 06:27:55 -04:00
Idan Gazit
2fc9f6bbc9 Trim down OAuth1 callable logic
Moved much of the validation out of requests and into oauthlib
2012-05-01 06:20:53 -04:00
Idan Gazit
65bf3ab201 Backing out stupidly incorrect str vs unicode check
It's simply wrong. Since compat.py sets str = unicode for py2, the
original logic is sound.
2012-05-01 06:20:53 -04:00
Idan Gazit
906fcd7328 Fix order of return values from OAuth Client.sign() 2012-05-01 06:20:52 -04:00
Idan Gazit
7b819852b9 Fix Content-Type validation in OAuth1 callable 2012-05-01 06:20:52 -04:00
Idan Gazit
9217a2523d Call auth callable before encoding body data 2012-05-01 06:20:52 -04:00
Idan Gazit
0aedef07c3 Improve _encode_params to handle lists of two-element tuples 2012-05-01 06:20:52 -04:00
Idan Gazit
3e60a9eb9c Proper test for str vs unicode when preparing data
In python 2.x, requests sets str = unicode in requests/compat.py. This causes
isinstance(foo, str) to return True even if foo is a unicode string.
2012-05-01 06:20:52 -04:00
Idan Gazit
798dc4ae1d Initial implementation of OAuth1 request signing with OAuthLib 2012-05-01 06:20:52 -04:00
Idan Gazit
632d9893b0 Improve docstring description of auth parameter 2012-05-01 06:20:52 -04:00
Idan Gazit
809d9863bf Add .egg-info/ dir to gitignore 2012-05-01 06:20:52 -04:00
Kenneth Reitz
742cbeaee1 httpbin weirdness 2012-05-01 05:51:59 -04:00
Kenneth Reitz
2159c80270 v0.11.2 2012-04-22 22:29:26 -04:00
Kenneth Reitz
8e9446d3fb revert 2012-04-22 22:29:00 -04:00
Kenneth Reitz
a7da521a62 merge conflict 2012-04-22 22:26:53 -04:00
Kenneth Reitz
2621fe2bff Revert "Add failing tests for invalid %encodings"
This reverts commit e28c1c9bfa.
2012-04-22 22:26:07 -04:00
Kenneth Reitz
3843a40f7c Revert "Reenable test_session_with_escaped_url test"
This reverts commit 3550ac7473.
2012-04-22 22:25:57 -04:00
Kenneth Reitz
f647352d01 v0.11.2 2012-04-22 22:08:39 -04:00
Kenneth Reitz
1631f0f5ae Merge pull request #552 from slingamn/bundle_2
attempt to use the OS's certificate bundle
2012-04-22 18:53:31 -07:00
Shivaram Lingamneni
b4eb8663af prefer certifi's bundle to the OS bundle 2012-04-22 18:43:59 -07:00
Shivaram Lingamneni
e1528ce3be add the FreeBSD certificate bundle path 2012-04-19 14:27:26 -07:00
Shivaram Lingamneni
1360e77cb2 Add a smoke test for https functionality 2012-04-16 17:50:40 -07:00
Shivaram Lingamneni
9921099546 Try to use the OS's CA certificate bundle for SSL verification 2012-04-16 15:28:31 -07:00
Kenneth Reitz
2f6b5feb1a Merge pull request #550 from reclosedev/develop
Fix issue #549. Add 'prefetch' to Session.__attrs__ and Requests.__init__
2012-04-14 03:19:10 -07:00
Roman Haritonov
d569a2d6bc fix #549 Add 'prefetch' to Session.__attrs__ and Requests.__init__ 2012-04-13 19:25:10 +04:00
Kenneth Reitz
e3ba495ed9 Merge branch 'develop' of https://github.com/catwell/requests into develop 2012-04-13 08:34:18 +02:00
Kenneth Reitz
d4a77cf2af Merge pull request #548 from umbrae/httperror_fix
A get with an invalid port should wrap urllib3's LocationParseError exception with our own.
2012-04-12 12:44:44 -07:00
Chris Dary
3a2eaa67a2 A get with an invalid port should wrap urllib3's LocationParseError exception with our own. 2012-04-12 12:35:34 -04:00
Pierre Chapuis
f3ad56f103 Encode Multipart Post data at Request creation
This fixes #298 (File upload not working with
HTTP digest authentication)
2012-04-12 17:49:48 +02:00
Pierre Chapuis
c3e6c41fc1 Fix infinite loop on wrong Digest Authentication 2012-04-12 16:33:15 +02:00
Kenneth Reitz
8a055c5d42 Merge pull request #535 from Jonty/develop
Fix decoding of invalid %encodings in URLs
2012-04-11 08:02:46 -07:00
Jonty Wareing
06e4971fe7 Rewrite unquote_unreserved based on urllib.unquote
This is almost entirely taken from the unquote implementation in urllib,
slightly modified for the case in hand. It now deals with invalid %encodings
rather than exploding, and the code is somewhat simpler.
2012-04-11 14:56:19 +00:00
Jonty Wareing
e28c1c9bfa Add failing tests for invalid %encodings 2012-04-11 14:55:43 +00:00
Jonty Wareing
3550ac7473 Reenable test_session_with_escaped_url test 2012-04-11 14:55:43 +00:00
Idan Gazit
51800bf36f Trigger setup.py develop when installing requirements 2012-04-11 14:05:33 +03:00
Idan Gazit
c89a3e207e Clarify digest hash method names 2012-04-11 14:02:59 +03:00
Kenneth Reitz
365c64fe3b #539 2012-04-10 23:00:25 -03:00
Kenneth Reitz
6b652f766d Merge pull request #545 from sharat87/patch-1
Add docs on sending lists for multivalued query params.
2012-04-10 08:43:46 -07:00
Shrikant Sharat Kandula
5a8a8f2bd3 Add docs on sending lists for multivalued query params. 2012-04-10 14:42:38 +05:30
Kenneth Reitz
821cbb3e08 moar 2012-04-09 04:22:10 -04:00
Kenneth Reitz
f8798aee28 Merge pull request #542 from newmaniese/develop
Attempting to address issue #377 by making content on the response model a little smarter
2012-04-08 20:13:38 -07:00
Michael Newman
11cd2b8253 Fixing a silly typo in my test 2012-04-08 18:46:26 -04:00
Michael Newman
1677c688cb Shamelessly adding myself to the authors list 2012-04-08 18:42:08 -04:00
Michael Newman
b92feb3f0a If there is no content in a response don't throw an error the second time that content is attempted to be read. This addresses issue #377 <https://github.com/kennethreitz/requests/issues/377> 2012-04-08 18:39:44 -04:00
Kenneth Reitz
7d4d91f013 Merge pull request #540 from jhalcrow/patch-1
Correct path to test_requests.py for setup.py test
2012-04-06 10:01:19 -07:00
Jonathan Halcrow
3279906737 Correct path to test_requests.py for setup.py test 2012-04-06 12:50:16 -03:00
Kenneth Reitz
c7b1bc8197 Merge pull request #534 from ThiefMaster/patch-1
Remove bad tab indent
2012-04-04 01:05:00 -07:00
Adrian
da288ad57a Remove bad tab indent 2012-04-04 11:03:49 +03:00
Andrey Petrov
03ae9bee74 Fixed typoe (s/repsonses/responses/) 2012-04-02 16:59:08 -07:00
Kenneth Reitz
a364395612 Merge pull request #530 from Osmose/sidebar_donate
Fix #506: Change "Support Requests" to "Donate".
2012-04-02 00:44:00 -07:00
Kenneth Reitz
37f3a29d49 Michael Kelly 2012-04-02 03:43:11 -04:00
Michael Kelly
48396f97a9 Fix #506: Change "Support Requests" to "Donate". 2012-04-02 00:40:20 -07:00
Kenneth Reitz
ccd19c53c8 Merge remote-tracking branch 'origin/develop' into develop 2012-03-31 17:39:31 -04:00
Kenneth Reitz
2bae0d295b new urllib3 version
#498
2012-03-31 17:39:26 -04:00
Kenneth Reitz
8755969629 Merge pull request #529 from piotr-dobrogost/develop
Removed unnecessary leading slashes in httpbin's endpoints
2012-03-31 13:21:17 -07:00
Piotr Dobrogost
e12d053ab8 Removed unnecessary leading slashes in httpbin's endpoints 2012-03-31 22:16:55 +02:00
Kenneth Reitz
13b07cb5d8 Merge pull request #528 from floppym/dist-tests
Include tests in tarballs.
2012-03-31 11:36:21 -07:00
Mike Gilbert
d3adc9d334 Include tests in tarballs. 2012-03-31 14:22:49 -04:00
Kenneth Reitz
751e2ea2d4 roadmap 2012-03-31 03:21:31 -04:00
Kenneth Reitz
dab3df7619 fake change for commit hook test 2012-03-31 03:11:43 -04:00
Kenneth Reitz
171b370b0e app engine #498 2012-03-31 03:08:12 -04:00
Kenneth Reitz
bcbc1be1c8 blah 2012-03-31 03:06:28 -04:00
Kenneth Reitz
04c329d703 license=open("LICENSE").read( 2012-03-31 02:53:14 -04:00
Kenneth Reitz
9a62aa6380 .. :changelog: 2012-03-31 02:51:38 -04:00
Kenneth Reitz
11e5c8eab7 HTTP/1.1 2012-03-31 00:08:38 -04:00
Kenneth Reitz
775b6f6f00 v0.11.1 2012-03-30 23:42:56 -04:00
Kenneth Reitz
dacc1d8aaf default to true for redirects now, since safe 2012-03-30 23:42:04 -04:00
Kenneth Reitz
18591920f3 upload data on redirects too 2012-03-30 23:31:19 -04:00
Kenneth Reitz
193eb42891 v0.11.1 2012-03-30 23:30:56 -04:00
Kenneth Reitz
b20d171c1c POST redirect => GET
#269
2012-03-30 23:28:07 -04:00
Kenneth Reitz
590211e13e Merge remote-tracking branch 'origin/develop' into develop 2012-03-30 23:15:47 -04:00
Kenneth Reitz
fff5269d1a Fix app engine error for #498 2012-03-30 23:15:43 -04:00
Kenneth Reitz
e831947be4 strict mode for #269 2012-03-30 23:15:31 -04:00
Kenneth Reitz
c205ce658f Merge pull request #519 from pulpe/doc-fix
little correction of curl in docs
2012-03-30 19:58:38 -07:00
pulpe
13060f89c7 little correction of curl in docs 2012-03-28 10:45:21 +02:00
Christopher Grebs
f25901874a Move pre_request to a more usable place, followup to #382
Having the hook called so late makes it impossible to overwrite the HTTP request
calling behavior and set self.sent to True in case of possible cache matches
for example.

This way we can interfere before we waste any CPU time to calculate
a request.
2012-03-27 15:38:56 +02:00
Kenneth Reitz
3cc6acaca4 Merge remote-tracking branch 'origin/develop' into develop 2012-03-25 15:26:58 -04:00
Kenneth Reitz
21ccf8f8c0 urllib3 v1.3 2012-03-25 15:26:55 -04:00
Kenneth Reitz
b973d08b0e Merge pull request #512 from silent1mezzo/master
Adds MissingSchema and InvalidSchema Exceptions
2012-03-25 12:00:57 -07:00
Adam McKerlie
d24ee0e1dc Created MissingSchema and InvalidSchema which inherits from RequestException and ValueError 2012-03-25 11:03:36 -04:00
Kenneth Reitz
afb1bd103a paypal 2012-03-25 03:56:00 -04:00
Kenneth Reitz
4c1852f928 Merge branch 'develop' of github.com:kennethreitz/requests into develop 2012-03-22 15:00:51 -04:00
Kenneth Reitz
6e26f5754b #508 2012-03-22 15:00:47 -04:00
Daniel Miller
82d1b340dc Suggesting changing "async.map(rs)" to "responses = async.map(rs)" just to show that it returns a list rather than mutating the original? Maybe this is apparent for most, but I was a bit confused =/ http://goo.gl/gE4up 2012-03-22 11:57:19 -07:00
Kenneth Reitz
eab2ab9faa Steve Pulec 2012-03-18 22:19:48 -04:00
Kenneth Reitz
12427e3434 Merge branch 'patch-1' of https://github.com/spulec/requests into develop 2012-03-18 22:18:49 -04:00
Kenneth Reitz
76bf523a1f Merge #491 2012-03-18 22:15:05 -04:00
Kenneth Reitz
613816dd9d Merge pull request #488 from newmaniese/develop
Excluding select from the monkey patching that gevent does to allow sele...
2012-03-18 19:08:51 -07:00
Kenneth Reitz
f8ec2544ce Merge pull request #494 from JDrosdeck/doc
Add quickstart doc and example for passing parameters in a GET request
2012-03-18 19:07:31 -07:00
Steve Pulec
3c2f52d681 Fixes issues #496 by having Response.ok catch all Requests exceptions. 2012-03-18 23:06:42 -03:00
Kenneth Reitz
3baf3ab069 Merge pull request #497 from iandanforth/develop
Develop
2012-03-18 19:04:56 -07:00
Kenneth Reitz
5c575b30c2 Merge remote-tracking branch 'origin/develop' into develop 2012-03-18 22:02:46 -04:00
Kenneth Reitz
e65f52aae4 remove debian packaging warning
it's up to date now
2012-03-18 22:02:43 -04:00
Ian Danforth
44277441d6 Sphinx throws an error if you don't escape ** in **kwargs 2012-03-18 18:11:15 -07:00
Ian Danforth
7b68c124d5 Sphinx throws an error if you don't escape ** in **kwargs 2012-03-18 18:09:58 -07:00
Jonathan Drosdeck
f2172922c5 Add quickstart doc and example for passing parameters in a GET request 2012-03-18 15:37:46 -04:00
Michael Newman
079a825ac3 Merge https://github.com/kennethreitz/requests into develop 2012-03-16 15:32:50 -04:00
Kenneth Reitz
9cf9d76eb5 Merge pull request #477 from maxcountryman/develop
potentially fixes #338
2012-03-15 18:15:27 -07:00
Kenneth Reitz
dc7029ec98 Merge pull request #483 from maxcountryman/cleanup
removing unused import
2012-03-15 18:14:35 -07:00
Kenneth Reitz
f0019c06d7 Merge pull request #489 from maxcountryman/patch-1
fixing link to AUTHORS in README
2012-03-15 18:13:26 -07:00
Max Countryman
a094ad8f31 fixing link to AUTHORS in README 2012-03-15 22:05:08 -03:00
Michael Newman
d6827a37d0 Excluding select from the monkey patching that gevent does to allow select.poll and requests.async in the same project
Fix for issue #487, including a regression test that checks the
existence of select.poll before and after loading requests.async.
2012-03-15 14:41:45 -04:00
Kenneth Reitz
5b7a79b0ff Merge pull request #486 from Pinkerton/patch-1
Fix issue #484
2012-03-14 20:08:17 -07:00
Pinkerton
ee861f4287 Fix issue #484 2012-03-14 19:54:06 -07:00
Kenneth Reitz
0c0bab3ad0 v0.11.0 2012-03-14 20:31:43 -04:00
Kenneth Reitz
1c73ec22e9 Nick Chadwick 2012-03-14 20:30:03 -04:00
Kenneth Reitz
4677ba5cd9 only verify private cert when verity is true 2012-03-14 20:29:30 -04:00
Kenneth Reitz
093709be4d Merge branch 'develop' of https://github.com/chadnickbok/requests into develop 2012-03-14 20:27:07 -04:00
Kenneth Reitz
f6ed16bbbe Merge remote-tracking branch 'origin/develop' into develop 2012-03-14 20:27:02 -04:00
chadnickbok@gmail.com
fc618aa78a Updated Requests api to accept a 'cert' argument.
This argument can be either a string, containing the path to a
pem-formatted key and certificate chain, or a tuple of (cert, key).

When supplied a tuple, the values are paths to an SSL certificate
chain file and key, respectively.
2012-03-14 17:15:29 -07:00
chadnickbok@gmail.com
82e69de44f Exposed key_file and cert_file in requests, to support https client certificates. 2012-03-14 15:57:30 -07:00
Max Countryman
8f8062723a removing unused import 2012-03-13 20:10:32 -04:00
Idan Gazit
cc4381b91e Merge branch 'develop' of github.com:kennethreitz/requests into develop 2012-03-13 17:05:24 -07:00
Idan Gazit
eae641485b Remove unused import 2012-03-13 17:04:26 -07:00
Kenneth Reitz
29309201b6 remove cruft 2012-03-13 16:44:45 -07:00
Kenneth Reitz
0dd6c40205 dict sequence 2012-03-13 16:42:16 -07:00
Kenneth Reitz
84d9a1b577 dict_to_sequence 2012-03-13 16:39:51 -07:00
Idan Gazit
17170a2ca7 Merge branch 'develop', remote-tracking branch 'upstream/develop' into develop 2012-03-13 12:59:33 -07:00
Kenneth Reitz
8d34538f4c further lies. 2012-03-12 20:54:02 -07:00
Kenneth Reitz
8d1a85a8d0 Merge branch 'josh' into develop 2012-03-12 20:51:59 -07:00
Kenneth Reitz
06f048e507 lies. 2012-03-12 20:46:23 -07:00
Max Countryman
83a9f2c740 explicating the cause of LookupError with a better comment 2012-03-11 22:22:29 -04:00
Max Countryman
bc5cc0dc92 potentially fixes #338
This attempts to fix an issue where encoding of a string might fail when the
encoding is set to some unknown format. Here we attempt to catch the
LookupException and subsequently blindly encode the string one final time.
That is we call str() over response.content without specifying an encoding.
This may still fail in certain cases but does properly handle the case of #338
by returning the expected string.
2012-03-09 17:30:35 -05:00
Kenneth Reitz
6562137731 cookie history 2012-03-09 08:59:12 -08:00
Kenneth Reitz
d078b69aef catch cookie errors that are prone to failure 2012-03-09 08:56:41 -08:00
Kenneth Reitz
0a1e527aec Merge of maxcountryman 2012-03-09 08:51:03 -08:00
Kenneth Reitz
9f55f503b1 merge conflict and fixes for python3 2012-03-09 08:43:12 -08:00
Kenneth Reitz
253cba373b _detected_encoding 2012-03-09 08:35:51 -08:00
Kenneth Reitz
9451ae2e98 iter_lines py3 compatibility
#470
2012-03-09 08:26:12 -08:00
Kenneth Reitz
d203349740 Merge remote-tracking branch 'origin/develop' into develop 2012-03-09 08:07:17 -08:00
Kenneth Reitz
4aad69594d chunk_size iter_lines 2012-03-09 08:07:10 -08:00
Kenneth Reitz
c7f165ae6f Merge branch 'iter_lines-fix' of https://github.com/fawek/requests into develop 2012-03-09 08:03:20 -08:00
Kenneth Reitz
98cbde1324 Chris Dary 2012-03-09 07:59:08 -08:00
Kenneth Reitz
77e5443f71 self.config.get('trust_env')
just for @mitsuhiko
2012-03-09 07:58:00 -08:00
Kenneth Reitz
e15ae8f9a7 v0.10.8 2012-03-09 07:55:54 -08:00
Kenneth Reitz
0eb2509449 Merge pull request #475 from umbrae/generate-chunked-valueerror-fix
Generate chunked ValueError fix
2012-03-08 14:57:58 -08:00
Chris Dary
bd0e002804 Move chunked head redirect test to ext 2012-03-08 14:44:07 -08:00
Chris Dary
0e65dff008 Remove unnecessary bit from previous branch.
This reverts commit e2645826be.
2012-03-08 13:22:38 -08:00
Chris Dary
fba77fc65f Potential fix for #436 2012-03-08 13:10:18 -08:00
Chris Dary
1cf5ec872c Merge remote-tracking branch 'upstream/develop' into develop 2012-03-08 08:19:33 -08:00
Johannes Gorset
21c2146be4 Facilitate proxy configuration by environment variables 2012-03-08 13:34:23 +01:00
Kenneth Reitz
2f91d8e773 bunk 2012-03-07 16:54:53 -08:00
Kenneth Reitz
946f7ec579 percent encoded 2012-03-07 16:50:02 -08:00
Kenneth Reitz
658d609e9f default encode_uri to True 2012-03-07 16:46:15 -08:00
Kenneth Reitz
abca7f0ad0 Merge remote-tracking branch 'origin/develop' into develop 2012-03-07 16:30:30 -08:00
Kenneth Reitz
cf5ddecc4c encode_uri 2012-03-07 16:28:04 -08:00
Kenneth Reitz
c1a44259d6 disablable encode_urls 2012-03-07 16:25:46 -08:00
Kenneth Reitz
54b2cb0b27 move config around a bit 2012-03-07 16:25:27 -08:00
Kenneth Reitz
09b6aef835 encode urls setting 2012-03-07 16:13:34 -08:00
Jakub Wieczorek
228c5e68ae Considerably simplify and fix the iter_lines() function
1. Do not use rstrip() as this would also throw away meaningful whitespaces
2. Avoid assuming what striplines() considers a line break terminator,
   the list of those is quite long in Unicode.
3. Add tests for the above edge cases.
2012-03-05 18:39:55 +01:00
Kenneth Reitz
6bb0529bed Merge pull request #466 from maxcountryman/develop
fixing a capitalization error in the send() method doc string
2012-03-01 14:21:45 -08:00
Max Countryman
1532effb68 fixing a capitalization error in the send() method doc string 2012-03-01 17:20:01 -05:00
Kenneth Reitz
65eaebb177 Merge remote-tracking branch 'origin/develop' into develop 2012-02-28 15:21:21 -05:00
Kenneth Reitz
ab0714ce9c develop 2012-02-28 15:21:12 -05:00
Kenneth Reitz
a3a7c504ad Merge pull request #464 from brendanmaguire/session_prefetch
Removed prefetch from args.
2012-02-28 12:19:25 -08:00
Brendan Maguire
ca45da39fa Removed prefetch from args. 2012-02-28 20:16:01 +00:00
Kenneth Reitz
313ff95ee4 Merge pull request #463 from brendanmaguire/session_prefetch
Prefetch for sessions
2012-02-28 12:08:48 -08:00
Brendan Maguire
97815c9930 Prefetch for sessions 2012-02-28 20:02:21 +00:00
Chris Dary
e2645826be Decode URL to utf-8 before joining.
To avoid UnicodeDecodeError's like on http://blip.fm/~1abvfu
2012-02-28 12:08:37 -05:00
Kenneth Reitz
7cc898f9ed master build test 2012-02-26 11:30:44 -05:00
Kenneth Reitz
ec979dc60a nose not found :( 2012-02-26 10:26:45 -05:00
Kenneth Reitz
32a6d07036 simpleci 2012-02-26 10:25:26 -05:00
Kenneth Reitz
d6c2d8f1dc simpleci 2012-02-26 10:24:48 -05:00
Kenneth Reitz
4a5c94f410 rudolf the red-nosed reindeer 2012-02-26 10:22:47 -05:00
Kenneth Reitz
0eb5b633aa v0.10.6 2012-02-25 23:17:45 -05:00
Kenneth Reitz
56c36ac27d history 2012-02-25 23:16:08 -05:00
Kenneth Reitz
508bd26741 Merge remote-tracking branch 'origin/develop' into develop 2012-02-25 23:15:54 -05:00
Kenneth Reitz
835053c55e #452 2012-02-25 23:15:33 -05:00
Kenneth Reitz
f0e0a62bbe Merge branch 'develop' of https://github.com/honzajavorek/requests into develop 2012-02-25 23:14:49 -05:00
Kenneth Reitz
bdcbabb758 Merge pull request #450 from Lukasa/issue_440
Issue #440: Accept '=' in cookie keys.
2012-02-25 20:14:11 -08:00
Kenneth Reitz
7cc2d468c7 urllib3 v1.2.2 2012-02-25 23:11:20 -05:00
Kenneth Reitz
83f4c01564 urllib3 release 2012-02-25 23:11:06 -05:00
Kenneth Reitz
cfeb485434 v0.10.5 2012-02-25 23:05:39 -05:00
Kenneth Reitz
d3b7f98814 hurray for passing tests 2012-02-25 22:44:46 -05:00
Kenneth Reitz
f5b0043c08 #457 2012-02-25 22:40:18 -05:00
Kenneth Reitz
6ce27f7d55 Merge branch 'develop' of https://github.com/asciimoo/requests into develop 2012-02-25 22:39:29 -05:00
asciimoo
531dc35126 [enh] async.imap added -- generator object handling 2012-02-26 04:04:33 +01:00
Kenneth Reitz
d974b46dbe simplify httpbin stuff 2012-02-25 21:57:30 -05:00
Kenneth Reitz
ea1d5f3648 Fix content-length: 0
#454
2012-02-24 18:42:33 -05:00
Kenneth Reitz
83b4081e85 Builds?? 2012-02-24 00:45:17 -05:00
Kenneth Reitz
e18e79d820 python3 fix 2012-02-24 00:44:01 -05:00
Kenneth Reitz
7234c7240a Merge branch 'master' into develop 2012-02-23 23:51:24 -05:00
Kenneth Reitz
7fa6276eb7 i can't believe i'm doing this 2012-02-23 22:43:16 -05:00
Kenneth Reitz
bbdf81dc1c teh spelling 2012-02-23 22:34:17 -05:00
Kenneth Reitz
4b0d53dcb7 no color 2012-02-23 22:27:29 -05:00
Kenneth Reitz
746d2cad5d mirrors 2012-02-23 22:22:43 -05:00
Kenneth Reitz
14f57f6585 Merge remote-tracking branch 'origin/develop' into develop 2012-02-23 22:21:16 -05:00
Kenneth Reitz
e63dff0a3a travis ci 2012-02-23 22:14:31 -05:00
Honza Javorek
09c0365255 str is redefined in compat module, but was not imported 2012-02-23 23:51:59 +01:00
Honza Javorek
1661bf6543 get_unicode_from_response returned str instead of unicode 2012-02-23 17:28:56 +01:00
Cory Benfield
2ef0b1b51d Accept '=' in cookie keys. 2012-02-21 22:51:38 +00:00
Kenneth Reitz
3c58600187 Merge pull request #449 from benweatherman/develop
Don't bonk if .netrc isn't readable
2012-02-21 13:55:50 -08:00
Ben
572c15d049 Don't bonk if .netrc isn't readable.
It's possible in some shared hosting environments that the .netrc file isn't readable by the user for the calling process. In that circumstance, just forgo the netrc authentication.
2012-02-21 15:53:33 -06:00
Kenneth Reitz
99a6074816 Merge pull request #447 from gwrtheyrn/patch-1
Added StringIO/Image example to quickstart documentation.
2012-02-21 00:27:16 -08:00
Danilo Bargen
8b750ee182 Added StringIO/Image example to quickstart documentation. 2012-02-21 09:24:52 +01:00
Kenneth Reitz
c9b4920230 v0.10.4 2012-02-20 16:21:25 -05:00
Kenneth Reitz
793d314c8d Merge branch 'netrc' into develop 2012-02-20 16:20:44 -05:00
Kenneth Reitz
8c873712fe .netrc 2012-02-20 16:20:07 -05:00
Kenneth Reitz
faae6b87b1 v0.10.4 2012-02-20 16:12:08 -05:00
Kenneth Reitz
fd7610dd7a python 3 unicode grr 2012-02-20 16:07:36 -05:00
Kenneth Reitz
b0e1865073 netrc fix 2012-02-20 15:43:45 -05:00
Kenneth Reitz
de0658f7e8 stick .netrc auth in pipeline 2012-02-20 15:43:38 -05:00
Kenneth Reitz
79bb9ee141 netrc parsing 2012-02-20 15:35:19 -05:00
Kenneth Reitz
2f33679cb3 spacing 2012-02-20 15:35:02 -05:00
Kenneth Reitz
6f5735274b history for HEAD 3xx 2012-02-20 14:02:13 -05:00
Kenneth Reitz
709828204a HEADs don't follow redirects by default. 2012-02-20 13:56:11 -05:00
Kenneth Reitz
b355b678a9 danger_mode redirect test 2012-02-20 13:51:46 -05:00
Kenneth Reitz
124c172c72 100k times 2012-02-20 13:49:29 -05:00
Kenneth Reitz
709c8bdcbf v0.10.3 2012-02-20 13:49:06 -05:00
Kenneth Reitz
2c55d269ce allow 3XX in danger_mode 2012-02-20 13:46:54 -05:00
Kenneth Reitz
e0d1b09ffe don't raise for redirects if they're not allowed 2012-02-20 13:40:55 -05:00
Kenneth Reitz
ceb42dd5de no more SOPA 2012-02-20 12:39:25 -05:00
Kenneth Reitz
80fe5dc147 none headers test
#433
2012-02-20 12:31:52 -05:00
Kenneth Reitz
d806ffc1cd test cleanups 2012-02-20 12:30:22 -05:00
Kenneth Reitz
4f75f1f41d Values can be none #433 2012-02-20 12:30:12 -05:00
Kenneth Reitz
fe10eeb5be SCHEMAS 2012-02-20 12:25:53 -05:00
Kenneth Reitz
cf37f63ccb #435 2012-02-20 12:22:11 -05:00
Kenneth Reitz
e7efce91fb models cleanup 2012-02-20 12:21:01 -05:00
Kenneth Reitz
5f834715d0 Merge branch 'issue_380' of https://github.com/Lukasa/requests into develop 2012-02-20 12:11:31 -05:00
Kenneth Reitz
dd89df314d v0.10.3 2012-02-20 12:09:46 -05:00
Kenneth Reitz
fdbb53db19 __file__ 2012-02-20 12:06:59 -05:00
Shrikant Sharat
590ce29743 Implemented #439. Added supporting test. 2012-02-19 15:11:19 +05:30
Kenneth Reitz
7548bc7ccc Update HISTORY.rst 2012-02-16 18:10:44 -05:00
Cory Benfield
544ebf402f Correct unfortunate typo. 2012-02-16 20:42:05 +00:00
Cory Benfield
640538adcb Fail if unsupported schemas are used.
requests only supports http and https. This change enforces that.
2012-02-16 20:20:20 +00:00
Cory Benfield
1ded0ad3d5 Remove a wayward change. 2012-02-16 19:32:20 +00:00
Cory Benfield
d339b0f64f Added failing test for issue #380. 2012-02-16 18:21:32 +00:00
Kenneth Reitz
8e2696b385 history 2012-02-15 03:14:48 -05:00
Kenneth Reitz
b5212ddc3d remove bunk utils for decoding 2012-02-15 03:09:40 -05:00
Kenneth Reitz
dacaae520a bytes data fix for python3 2012-02-15 03:09:26 -05:00
Kenneth Reitz
e663c77e70 fix bytes 2012-02-15 02:54:00 -05:00
Kenneth Reitz
ec109c9ac8 path fixes 2012-02-15 02:53:50 -05:00
Kenneth Reitz
0b9a2a1581 move tests over 2012-02-15 02:52:32 -05:00
Kenneth Reitz
2759060559 it's a start 2012-02-15 02:45:21 -05:00
Kenneth Reitz
00b13673e3 simplify 2012-02-15 02:28:58 -05:00
Kenneth Reitz
91ac5ba110 don't rely on urllib3's decode 2012-02-15 02:07:55 -05:00
Kenneth Reitz
0d8c08cd22 binary data upload bug test 2012-02-15 02:03:29 -05:00
Kenneth Reitz
ab4c03adc3 cleanups 2012-02-15 02:03:13 -05:00
Kenneth Reitz
75b0c4be1b latin1, remove unicode_literals
Fixes #407
2012-02-15 02:01:36 -05:00
Kenneth Reitz
4a8e6415c7 sp 2012-02-15 01:47:08 -05:00
Kenneth Reitz
58bf158840 RuntimeError 2012-02-15 01:46:06 -05:00
Kenneth Reitz
c0f066626e whitespace 2012-02-15 01:42:57 -05:00
Kenneth Reitz
69c7a8638e make all the tests 2012-02-15 01:42:52 -05:00
Kenneth Reitz
1b6f1b091c Merge branch '400-header_expand-unicode' of https://github.com/acdha/requests into develop 2012-02-15 01:25:29 -05:00
Kenneth Reitz
d39cdc45d1 decode response url again 2012-02-15 01:21:38 -05:00
Kenneth Reitz
7f761f3adf history for 0.10.2 2012-02-15 01:18:41 -05:00
Kenneth Reitz
5e76943f02 Merge branch 'develop' of https://github.com/Lukasa/requests into develop 2012-02-15 01:08:10 -05:00
Kenneth Reitz
b887ea3b60 Merge branch 'mgiuca-uri-cleanup-nonpath' into develop 2012-02-15 01:00:52 -05:00
Matt Giuca
690426ac86 Added Matt Giuca to AUTHORS. 2012-02-15 12:06:34 +11:00
Matt Giuca
b8298b0710 Rename utils.requote_path to requote_uri.
It is now applied to a whole URI, not just the path.
2012-02-15 12:03:08 +11:00
Matt Giuca
3bd5406c06 Now requotes the entire URL, not just the path (Issue #429). 2012-02-15 12:00:47 +11:00
Matt Giuca
3ae0ff3685 Added test cases for URI cleaning in the query part (Issue #429). 2012-02-15 12:00:27 +11:00
Cory Benfield
80e29bfcab Change the RFC we reference. 2012-02-14 14:11:25 +00:00
Cory Benfield
d7107c2cdc Make clearer the source of forbidden characters 2012-02-14 12:58:35 +00:00
Cory Benfield
658da765ec Keep non RFC cookie key characters separate.
Moved the characters that we accept in keys but that the RFC forbids
into a separate string to keep track of them.
2012-02-14 10:25:40 +00:00
Kenneth Reitz
9e2f5dd0ed Merge branch 'py3-uri-encoding' of https://github.com/mgiuca/requests into develop 2012-02-14 04:30:10 -05:00
Matt Giuca
1ffce4f7dc Simplify requote_path.
It no longer needs to split on '/' since '/' will not be encoded.
2012-02-14 12:57:49 +11:00
Matt Giuca
fcac1c3746 Fixed URI encoding of reserved characters (Issue #369).
Previously, util.requote_path would unquote and requote all characters,
causing reserved characters to become encoded (changing the semantics of the
URI). Now, it has special code for unquoting just the unreserved characters,
then quotes only illegal characters.
This ensures that illegal characters are fixed, and URIs are normalised, but
reserved characters do not erroneously become quoted.
Test case test_session_with_escaped_url now passes.
2012-02-14 12:51:03 +11:00
Matt Giuca
c0763bb8d5 Changed test case test_path_is_not_double_encoded.
Uses the space character instead of ~ as a test (since ~ is unreserved, it
shouldn't really be encoded at all).
2012-02-14 12:49:31 +11:00
Matt Giuca
75bd9d0e94 Added test case testing URI normalisation.
Tests that percent-encoded unreserved characters get de-encoded.
2012-02-14 12:20:48 +11:00
Matt Giuca
08bc1198d3 Added test case for Issue #369.
Tests that legal reserved and unreserved characters in the path are not
percent-encoded. Currently fails.
2012-02-14 12:15:32 +11:00
Matt Giuca
cf54f60367 Fixed URI re-encoding on Python 3 (Issue #369).
Request.full_url now performs requoting of the path (like it does in Python 2).
Request.path_url no longer quotes the already-quoted path (double quoting).
Fixed utils.requote_path so it works properly in Python 3.
2012-02-14 11:50:02 +11:00
Matt Giuca
329efcae6e Added test case for quoted and illegal characters in the URL.
This is a test case for issue #369.
It passes in Python 2, but fails in Python 3 (though the test suite doesn't
actually work in Python 3, it can be shown to fail with some modification).
2012-02-14 11:47:14 +11:00
Kenneth Reitz
5a2a78f7df Merge pull request #425 from Lukasa/develop
Issue #335: Accept unusual keys in cookies.
2012-02-13 16:14:39 -08:00
Cory Benfield
f72c13ffda Accept unusual keys in cookies.
The Oreos module throws CookieErrors when it catches keys that have
characters that shouldn't be in them, like colons and braces. Other
services are happy to send out such keys, however. This commit makes
requests non-standards compliant, just like everyone else is.
2012-02-14 00:10:26 +00:00
Chris Adams
0a17badb21 header_expand: handle Unicode strings (closes #400) 2012-02-13 11:10:05 -05:00
Kenneth Reitz
12f9aa3669 Merge pull request #410 from eriolv/develop
Fix SyntaxError on Python3 because "except Error, e" is not supported anymore
2012-02-12 02:16:48 -08:00
Kenneth Reitz
afa2e86a4d Merge pull request #413 from bancek/patch-1
Typo fix in oreos/structures.py
2012-02-06 09:08:03 -08:00
Luka Zakrajšek
b7842ab34b Typo fix in oreos/structures.py 2012-02-06 13:42:34 +01:00
Greg Taylor
f8b3141204 Use basestring instead of str to determine when to return headers as-is. This makes sure that unicode instances aren't enumerated. 2012-02-05 13:57:35 -05:00
Daniele Tricoli
c40d6d0509 Since requests 0.10.1 dropped Python5 support, to catch an exception and
store the exception object in a variable the "as" keyword can be used so
Python3 will not raise a SyntaxError
2012-02-05 04:18:22 +01:00
Kenneth Reitz
a74481a1d4 Update docs/community/faq.rst 2012-02-03 13:24:00 -05:00
Kenneth Reitz
b898415d0d :trollface:
because i can.
2012-02-02 17:23:47 -05:00
Kenneth Reitz
b47effe5d8 test #2 2012-02-01 13:35:34 -05:00
Kenneth Reitz
4f10605389 quick test 2012-02-01 13:33:59 -05:00
Kenneth Reitz
120e62900b Native Instruments! 2012-01-31 02:15:55 -05:00
Kenneth Reitz
986704dc62 v0.10.2 2012-01-30 09:41:09 -05:00
Kenneth Reitz
2f13956357 Merge branch 'unicode_missing_self' of https://github.com/Telofy/requests into develop 2012-01-30 09:35:53 -05:00
Kenneth Reitz
8d700dd1e5 Merge branch 'pr-urlfix-1' of https://github.com/brendoncrawford/requests into develop 2012-01-30 09:33:31 -05:00
Kenneth Reitz
5be412db13 Brendon Crawford 2012-01-30 09:33:14 -05:00
Telofy
a61a861cfb The self was missing again, and I think the two blocks were redundant. 2012-01-30 12:23:43 +01:00
Brendon Crawford
c363ca476f Added ability to check if missing trailing slash in path.
Previously this URL would not work:

    http://example.com?foo=bar

But this URL would work:

    http://example.com/?foo=bar

Even though a slash is required for a valid URL, it is a common use case
for the slash to be left out, so it would be a good idea to account for this.
2012-01-29 23:24:54 -08:00
Kenneth Reitz
319b1ed551 Merge branch '239-socket-leak' of https://github.com/acdha/requests into develop 2012-01-29 19:06:41 -05:00
Chris Adams
67f50a0fe5 Less redundant freeing of resources on redirects
With 495646bb6a the double flush is no longer
needed.
2012-01-29 18:45:14 -05:00
Chris Adams
b98cc8b4e9 Revert "Initial stop-the-bleeding fix"
This reverts commit 730c0e2e2b.
2012-01-29 18:43:13 -05:00
Chris Adams
495646bb6a async: force prefetch=True on send
… otherwise we can run out of sockets before any of the responses are ever
processed
2012-01-29 18:42:48 -05:00
Kenneth Reitz
4516bd45b2 Release redirected connections.
#239
2012-01-29 18:00:33 -05:00
Chris Adams
730c0e2e2b Initial stop-the-bleeding fix
This is redundant but it avoids crashing otherwise working code. The code-smell
from duplication suggests that this interface should be refactored slightly.
2012-01-29 17:31:59 -05:00
Chris Adams
3020d0e56a Consistent self.cookies usage
This avoids two variables pointing to the same thing and avoids
a duplicate dict update() call
2012-01-29 16:52:08 -05:00
Chris Adams
49bed18a83 Minor PEP-8 cleanup 2012-01-29 16:51:28 -05:00
Kenneth Reitz
e6959412aa only do oreos for 2 2012-01-28 23:10:03 -05:00
Kenneth Reitz
04c0bcc9b4 wow. 2012-01-27 11:18:56 -06:00
Kenneth Reitz
ec4edae977 lazy tests 2012-01-27 11:16:47 -06:00
David Kemp (Work)
f478c34671 add failing test for unicode headers (python 2.x only) 2012-01-26 18:45:38 +00:00
Kenneth Reitz
a0ef4f2358 Merge pull request #389 from johtso/patch-1
Fix httpbin urls with missing .org in docs
2012-01-25 22:40:30 -08:00
Johannes
ca57e93ebf Fix httpbin urls with missing .org 2012-01-26 02:13:04 +00:00
Kenneth Reitz
5ca5b7ec65 Merge remote-tracking branch 'origin/develop' into develop 2012-01-25 11:26:08 -05:00
Kenneth Reitz
2b202aabd7 David Kemp 2012-01-25 11:26:04 -05:00
Kenneth Reitz
cb64d31171 Merge pull request #387 from davidarkemp/develop
fix problem with path being double escaped
2012-01-25 08:25:26 -08:00
David Kemp (Work)
80eafe3b63 fix problem with path being double escaped 2012-01-25 16:21:07 +00:00
Kenneth Reitz
16aa444261 Merge branch 'develop' of https://github.com/mastahyeti/requests into develop 2012-01-25 09:04:41 -05:00
Kenneth Reitz
0bbdbac17f moar tests 2012-01-25 09:03:20 -05:00
Piotr Dobrogost
c430b60e38 Standard tests from RequestsTestSuite run using async api 2012-01-24 21:56:59 +01:00
Ben
02f6555536 added myself to authors.rst 2012-01-24 09:59:41 -06:00
Mastahyeti
4293e3fdb2 moved call to pre_request hook, allowing for more meaningful use. 2012-01-23 20:56:05 -06:00
Kenneth Reitz
50298bbf97 80k 2012-01-23 02:52:38 -05:00
Kenneth Reitz
ac82fa47a0 @takluyver 2012-01-23 02:49:10 -05:00
Kenneth Reitz
976bfbf687 text 2012-01-23 02:43:38 -05:00
Kenneth Reitz
1bc377b188 r.text 2012-01-23 02:42:34 -05:00
Kenneth Reitz
a89530aef5 explain binary response data 2012-01-23 02:42:05 -05:00
Kenneth Reitz
c32b1cd6d6 better feature list 2012-01-23 02:34:42 -05:00
Kenneth Reitz
90f5c8bd85 r.text 2012-01-23 02:32:09 -05:00
Kenneth Reitz
878bb61d24 readme update 2012-01-23 02:31:16 -05:00
Kenneth Reitz
8493d8329e PYTHON 3 2012-01-23 02:28:01 -05:00
Kenneth Reitz
57aeafa115 pythons 2012-01-23 02:21:35 -05:00
Kenneth Reitz
a29e862adf new pythons! 2012-01-23 02:21:30 -05:00
Kenneth Reitz
5ed62e1137 don't let that happen... 2012-01-23 02:19:56 -05:00
Kenneth Reitz
f99a2534c9 v0.10.1 2012-01-23 02:18:26 -05:00
Kenneth Reitz
a939423006 dammit, i changed again 2012-01-23 02:03:16 -05:00
Kenneth Reitz
4493acc5ee fix 26 2012-01-23 02:01:53 -05:00
Kenneth Reitz
c4eb9301bb assert isinstance 2012-01-23 01:59:13 -05:00
Kenneth Reitz
57ba337e79 assert isinstance 2012-01-23 01:58:32 -05:00
Kenneth Reitz
3d542693bc no more unittest2 2012-01-23 01:56:58 -05:00
Kenneth Reitz
5f2607ffca yikes 2012-01-23 01:54:00 -05:00
Kenneth Reitz
ab916a8a8d hmm 2012-01-23 01:52:33 -05:00
Kenneth Reitz
1fb4bd82f7 cchch changes 2012-01-23 01:48:40 -05:00
Kenneth Reitz
d892e93589 requirements.txt 2012-01-23 01:47:39 -05:00
Kenneth Reitz
38c2532c5f new certifi 2012-01-23 01:46:41 -05:00
Kenneth Reitz
18b5ee7d5b fixes 2012-01-23 01:44:07 -05:00
Kenneth Reitz
9fd2d07c1d reqs fixes 2012-01-23 01:44:01 -05:00
Kenneth Reitz
e7bcc3b332 oh snap 2012-01-23 01:32:09 -05:00
Kenneth Reitz
b001fcf968 SimpleCookie 2012-01-23 01:02:16 -05:00
Kenneth Reitz
125619c783 urllib3 update 2012-01-23 01:01:42 -05:00
Kenneth Reitz
fe6882623c more stuff and things 2012-01-23 00:52:38 -05:00
Kenneth Reitz
11c4315da3 good 2012-01-23 00:43:01 -05:00
Kenneth Reitz
672e66ba5f compat 2012-01-23 00:34:31 -05:00
Kenneth Reitz
bcfddb3d65 cleanups and stuffs 2012-01-23 00:29:50 -05:00
Kenneth Reitz
9cae98c167 blah 2012-01-23 00:25:48 -05:00
Kenneth Reitz
b0e2e4f284 blah 2012-01-23 00:15:25 -05:00
Kenneth Reitz
36842db26f stuff and things 2012-01-22 20:12:49 -05:00
Kenneth Reitz
e84a7c7e6f whatever 2012-01-22 20:12:43 -05:00
Kenneth Reitz
2109afc144 further 2012-01-22 19:42:13 -05:00
Kenneth Reitz
786dfdd7e5 python3 version of urllib3 2012-01-22 15:06:58 -05:00
Kenneth Reitz
62d05f842d dates 2012-01-21 23:19:49 -05:00
Kenneth Reitz
fc3b03a5f5 @gulopine 2012-01-21 23:18:06 -05:00
Kenneth Reitz
f4f2bd9fab Response.url. 2012-01-21 23:10:37 -05:00
Kenneth Reitz
b0555b68e7 history! 2012-01-21 23:06:34 -05:00
Kenneth Reitz
497695864b Beautiful history. 2012-01-21 23:03:07 -05:00
Kenneth Reitz
128b49a1fb whitespace 2012-01-21 23:00:28 -05:00
Kenneth Reitz
0dbda6665d cleanup 2012-01-21 22:59:57 -05:00
Kenneth Reitz
464279f48d typo
Signed-off-by: Kenneth Reitz <me@kennethreitz.com>
2012-01-21 22:58:38 -05:00
Kenneth Reitz
b14a244ab4 simpler 2012-01-21 22:57:24 -05:00
Kenneth Reitz
2c7e920298 don't double decode 2012-01-21 22:56:53 -05:00
Kenneth Reitz
b725bfd3fb Use chardet for detection when no encoding is provided. 2012-01-21 22:55:41 -05:00
Kenneth Reitz
47e96b8040 chardet 2012-01-21 22:35:19 -05:00
Kenneth Reitz
9a1348707c chardet 2012-01-21 22:35:11 -05:00
Kenneth Reitz
ada98899f8 build number 2012-01-21 20:00:12 -05:00
Kenneth Reitz
16a7a26452 v0.10.0 2012-01-21 19:58:51 -05:00
Kenneth Reitz
2c04f9d199 Merge remote-tracking branch 'origin/develop' into develop 2012-01-21 17:48:55 -05:00
Kenneth Reitz
70e98e47cf No encoding? r.text is None. 2012-01-21 17:48:51 -05:00
Kenneth Reitz
b525dc29f7 Merge pull request #370 from piotr-dobrogost/develop
tiny map() refactoring
2012-01-21 05:13:15 -08:00
Kenneth Reitz
a3fb5ac326 history 2012-01-21 07:47:46 -05:00
Kenneth Reitz
8e6f98f44e Merge branch 'redsea' into develop 2012-01-21 07:17:30 -05:00
Kenneth Reitz
9ba93b885c history 2012-01-21 07:17:23 -05:00
Kenneth Reitz
5f44d79729 move digest to new register_hook
#372
2012-01-21 07:14:26 -05:00
Kenneth Reitz
a3b26c7e5b Provide new register_hook system.
#372
2012-01-21 07:13:58 -05:00
Kenneth Reitz
e9be7c1a58 make list of HOOKS available 2012-01-21 07:07:18 -05:00
Kenneth Reitz
6c359b2457 Merge branch 'develop' of https://github.com/jgorset/requests into redsea 2012-01-21 06:36:06 -05:00
Johannes Gorset
7647e52943 Facilitate for multiple hooks 2012-01-21 12:14:55 +01:00
Johannes Gorset
a0ae2e6c7b Default the encoding of "text" media subtypes to "ISO-8859-1"
Ref. RFC2616 (HyperText Transfer Protocol), section 3.7.1 (Canonicalization and Text Defaults).
2012-01-21 11:01:45 +01:00
Kenneth Reitz
efd2b57b92 cleanup docs for request defaults 2012-01-21 01:44:57 -05:00
Kenneth Reitz
47aba0cc20 remove is_error 2012-01-21 01:31:23 -05:00
Kenneth Reitz
f5a2b75924 only try to decode if self.encoding is set 2012-01-21 01:28:26 -05:00
Kenneth Reitz
49a38ac89a New bytes/unicode separation.
Response.content for bytes.
New Response.text for unicode.
2012-01-21 01:24:21 -05:00
Kenneth Reitz
6d071f4331 kill decode_unicode config 2012-01-21 01:23:35 -05:00
Piotr Dobrogost
3873121c01 tiny map() refactoring 2012-01-20 21:42:25 +01:00
Kenneth Reitz
5bff8e362f Update docs/dev/todo.rst 2012-01-19 18:43:43 -05:00
Kenneth Reitz
62733146be Merge pull request #366 from jgorset/how-to-help
Elaborate on how to help
2012-01-19 15:42:55 -08:00
Kenneth Reitz
99f6581770 Merge pull request #368 from jgorset/unicode-response-url
Decode response URL to a unicode string.
2012-01-19 15:42:27 -08:00
Johannes Gorset
b37fbf30a3 Decode response URL to a unicode string.
Fixes #182
2012-01-20 00:34:44 +01:00
Johannes Gorset
e65d0ac9e3 Elaborate on how to help 2012-01-20 00:09:30 +01:00
Kenneth Reitz
61a0e85672 Merge pull request #364 from gthank/8efb6cc870bd23de0d8d87708217d818236a733f
Allow sessions and async requests to mix.
2012-01-19 11:12:23 -08:00
Kenneth Reitz
c18e6459a8 v0.9.3 2012-01-18 21:56:33 -05:00
Kenneth Reitz
6db255d17d Merge branch 'develop' of github.com:kennethreitz/requests into develop 2012-01-18 21:49:25 -05:00
Kenneth Reitz
49d79546e8 v0.9.2 2012-01-18 21:25:03 -05:00
Kenneth Reitz
f3ba022f46 Merge branch 'streaming' of https://github.com/RonnyPfannschmidt/requests into develop 2012-01-18 21:05:56 -05:00
Kenneth Reitz
17f2002839 Merge pull request #363 from gazpachoking/develop
Stop always verifying certs for same host that has verified once.
2012-01-18 17:19:43 -08:00
Chase Sterling
a6ee9757a7 Add myself to AUTHORS 2012-01-18 19:51:10 -05:00
Chase Sterling
d9cb18ad2a Make sure verify=False is respected for session even when there has already been a verified request to the same host.
Update tests to expose the (fixed) problem.
2012-01-18 19:49:22 -05:00
Kenneth Reitz
557480cfe8 SOPA 2012-01-18 11:14:32 -05:00
Kenneth Reitz
5dae0bb9bf Merge pull request #360 from mastahyeti/develop
Make requests.async.send asynchronous
2012-01-17 13:32:04 -08:00
Ben
e38046e6c6 The async.send method wasn't really doing anything useful. It was just calling the r.send() method of the Request object 'r'. It took an optional kwarg pools, and assigned it to r._pools which isn't used by anything. This situation was eaither broken or not fully implemented yet. I modified async.map to call r.send rather than send(r) and then modified async.send to actually make use of the pool that it is passed. 2012-01-17 15:21:09 -06:00
Ben
97be9ee4cd The async.send method wasn't really doing anything useful. It was just calling the r.send() method of the Request object 'r'. It took an optional kwarg pools, and assigned it to r._pools which isn't used by anything. This situation was eaither broken or not fully implemented yet. I modified async.map to call r.send rather than send(r) and then modified async.send to actually make use of the pool that it is passed. 2012-01-17 15:20:52 -06:00
Ben
c658b363e3 The async.send method wasn't really doing anything useful. It was just calling the r.send() method of the Request object 'r'. It took an optional kwarg pools, and assigned it to r._pools which isn't used by anything. This situation was eaither broken or not fully implemented yet. I modified async.map to call r.send rather than send(r) and then modified async.send to actually make use of the pool that it is passed. 2012-01-17 15:17:38 -06:00
Ronny Pfannschmidt
7f9cef0114 close the chunked fd at the end and honor content chunksizes for a potential first chunk 2012-01-17 18:14:47 +01:00
Hank Gay
8efb6cc870 Allow mixing sessions and async. 2012-01-17 11:44:59 -05:00
Ronny Pfannschmidt
1c8a141711 remove debug print 2012-01-17 17:39:37 +01:00
Ronny Pfannschmidt
4d38790b5b even more evil, fixes my misstakes with chunked reading 2012-01-17 17:38:52 +01:00
Ronny Pfannschmidt
5cfbb0aaf5 insanity for chunked iteration 2012-01-17 13:16:09 +01:00
Ronny Pfannschmidt
29271a4100 make Response.iter_lines yield the pending buffer if its actually a complete line 2012-01-17 12:47:22 +01:00
Kenneth Reitz
df0dc2b67a +1 2012-01-15 16:39:46 -05:00
Kenneth Reitz
ff286f351c Update AUTHORS.rst 2012-01-13 17:38:28 -05:00
Kenneth Reitz
430125b396 Merge pull request #355 from fkumro/develop
Added prefetch documentation for api
2012-01-13 14:38:09 -08:00
Frank Kumro
0536e5b708 Added prefetch documentation for api 2012-01-12 22:16:31 -05:00
Kenneth Reitz
e6990162e5 Tom Moertel 2012-01-12 12:53:45 -08:00
Kenneth Reitz
d9b304b906 Merge pull request #352 from tmoertel/develop
Fix bug in HTTP-digest auth w/ URI having query string
2012-01-12 12:52:02 -08:00
Tom Moertel
79f5d532c6 Fix bug in HTTP-digest auth w/ URI having query string 2012-01-10 18:18:54 -05:00
Kenneth Reitz
6af6a08b7a Merge pull request #344 from sharat87/patch-1
Do not pass over the `session` argument to `Session.request` method
2012-01-10 11:11:01 -08:00
Kenneth Reitz
96d5044722 Merge pull request #348 from LucianU/develop
Fixed code in 'Event Hooks' section
2012-01-10 11:10:02 -08:00
Kenneth Reitz
4258201900 Update AUTHORS.rst 2012-01-10 11:09:09 -08:00
Kenneth Reitz
11e5126454 Merge pull request #347 from LucianU/patch-1
Printing the entire traceback, instead of just a warning, when an except...
2012-01-10 11:08:53 -08:00
Kenneth Reitz
9e953f3320 Merge pull request #350 from piotr-dobrogost/develop
fixes issue #349
2012-01-10 11:07:45 -08:00
Piotr Dobrogost
bbbeedb0a2 fixes issue #349 2012-01-10 16:47:21 +01:00
Lucian Ursu
de17f4e5a4 Fixed code in 'Event Hooks' section 2012-01-10 12:17:57 +02:00
Lucian Ursu
86eba21b8a Printing the entire traceback, instead of just a warning, when an exception is encountered 2012-01-10 12:10:58 +02:00
Shrikant Sharat Kandula
53d679edba The request method of Session class does not take a session argument. But api.request does. So, it has to be popped before you can send the whole kwargs dict to Session.request method. 2012-01-09 11:16:54 +05:30
Kenneth Reitz
89c90add2c Update docs/index.rst 2012-01-07 18:32:56 -05:00
Kenneth Reitz
a869be1e5a Merge pull request #343 from shazow/urllib3-attribution
urllib3 attribution in docs
2012-01-07 15:28:17 -08:00
Andrey Petrov
68619b8088 Merge branch 'develop' of https://github.com/kennethreitz/requests into urllib3-attribution 2012-01-07 15:19:02 -08:00
Andrey Petrov
534cdd7587 Rewriting history for correctness. 2012-01-07 15:17:14 -08:00
Andrey Petrov
e185aec920 Adding a humble mention of urllib3 to the Requests intros. 2012-01-07 15:17:06 -08:00
Kenneth Reitz
14e8eea0ee Merge remote-tracking branch 'origin/develop' into develop 2012-01-07 17:18:53 -05:00
Kenneth Reitz
2b849545ea urllib3 update 2012-01-07 17:18:49 -05:00
Kenneth Reitz
15396fb2f9 Update docs/user/advanced.rst 2012-01-07 13:44:09 -05:00
Kenneth Reitz
1acef81ed3 Merge pull request #342 from bjedwards/patch-1
Fix syntax error in last commit.
2012-01-06 12:53:56 -08:00
Ben Edwards
a25141f9f4 Fix syntax error in last commit. 2012-01-06 13:52:49 -07:00
Kenneth Reitz
d339ffe9d9 @ojii 2012-01-06 11:36:04 -05:00
Kenneth Reitz
c5ba5888b5 Merge pull request #341 from ojii/patch-1
Give a more useful error message when the URL supplied does not contain ...
2012-01-06 08:20:49 -08:00
Jonas Obrist
3415e6de0b Give a more useful error message when the URL supplied does not contain a schema. 2012-01-06 16:20:33 +01:00
Kenneth Reitz
638532dd9a v0.9.1 2012-01-06 01:10:53 -05:00
Kenneth Reitz
c6fc7d99b5 Merge branch 'develop' of https://github.com/gazpachoking/requests into develop 2012-01-06 01:08:06 -05:00
Kenneth Reitz
281e0598bc Merge pull request #333 from bryanhelmig/develop
Add eager mode for raising errors immediately.
2012-01-05 22:04:11 -08:00
Bryan Helmig
aa39fb0c80 mention of error modes in quickstart 2012-01-05 14:11:19 -06:00
Bryan Helmig
459a91c54f highway to the danger_mode 2012-01-05 12:50:44 -06:00
Bryan Helmig
115b51e68c add eager mode for raising errors immediately 2012-01-04 22:08:01 -06:00
Kenneth Reitz
4441697e49 Update README.rst 2012-01-03 10:21:13 -05:00
Chase Sterling
5174ab4325 Make sure newlines at chunk borders do not get dropped using iter_lines. 2012-01-03 00:38:59 -05:00
Chase Sterling
95911f059a Refactor r.iter_lines to retrieve more than one byte at a time.
Fixes universal line ending handling, but takes away ability to specyfy
custom line endings.
2012-01-02 16:19:35 -05:00
Kenneth Reitz
e3288d5e33 Update docs/user/install.rst 2012-01-02 02:50:09 -05:00
Kenneth Reitz
49140d6880 2012 2012-01-01 00:44:20 -05:00
Chase Sterling
9c6ffc5303 Refactor stream_decode_gzip and _deflate into one function, stream_decompress.
stream_decompress will now iterate over the raw data if there is a problem with decompression
Remove gzip decoding from Response.content, as urllib3 was doing it anyway.
2011-12-30 22:18:08 -05:00
Chase Sterling
f80984f377 Implement automatic deflating when using response.iter_content. refs #327
Refactor response.iter_lines to use responset.iter_content.
2011-12-30 18:55:56 -05:00
Kenneth Reitz
9c0a0fbd01 ch ch changes 2011-12-28 04:49:51 -05:00
Kenneth Reitz
57dbab2932 v0.9.0 history 2011-12-28 04:48:57 -05:00
Kenneth Reitz
7fdb541e2d make it true 2011-12-28 04:48:27 -05:00
Kenneth Reitz
082f4d8948 packaging 2011-12-28 04:38:38 -05:00
Kenneth Reitz
8aa015ffc9 v0.8.9 2011-12-28 04:26:23 -05:00
Kenneth Reitz
cfb1a478ac ssl hostname 2011-12-28 04:25:43 -05:00
Kenneth Reitz
28db6c3f53 engrish 2011-12-28 03:58:08 -05:00
Kenneth Reitz
5f768b191d certifi v0.0.4 2011-12-28 03:51:41 -05:00
Kenneth Reitz
d9a9a981bc certifi v0.0.2 2011-12-28 03:30:33 -05:00
Kenneth Reitz
9fcfec18da ssl docs 2011-12-28 03:18:40 -05:00
Kenneth Reitz
a83268b01b v0.8.8 release 2011-12-28 03:01:36 -05:00
Kenneth Reitz
a1afbfbaa3 external tests 2011-12-28 03:01:00 -05:00
Kenneth Reitz
4114b04521 v0.8.8! 2011-12-28 03:00:53 -05:00
Kenneth Reitz
f7e67c01ea only use session verify when not modified 2011-12-28 02:57:36 -05:00
Kenneth Reitz
544a5fea59 more info 2011-12-28 02:51:49 -05:00
Kenneth Reitz
0a8bb2e1b3 verification support in sessions 2011-12-28 02:51:42 -05:00
Kenneth Reitz
5184f0c5a9 SSL support! 2011-12-28 02:43:13 -05:00
Kenneth Reitz
9a1a4136ac new SSLError 2011-12-28 02:43:03 -05:00
Kenneth Reitz
ca26c1a253 api cleanup 2011-12-28 02:42:57 -05:00
Kenneth Reitz
a91ac242f3 simplify api.request 2011-12-28 01:51:26 -05:00
Kenneth Reitz
31d495fb02 certifi 2011-12-28 01:28:49 -05:00
Kenneth Reitz
bdda99c0c1 urllib3 update 2011-12-27 23:14:54 -05:00
Kenneth Reitz
9ed93044e0 Merge branch 'develop' 2011-12-24 03:16:54 -05:00
Kenneth Reitz
0bfc029b5e v0.8.7 2011-12-24 03:16:40 -05:00
Kenneth Reitz
4eb2759400 force safe mode for async 2011-12-24 03:06:13 -05:00
Kenneth Reitz
0001f5b651 Merge remote-tracking branch 'origin/develop' into develop 2011-12-23 17:24:34 -05:00
Ori Livneh
e1615e0f1e Make safe_mode handle exceptions more consistently 2011-12-23 16:14:46 -05:00
Kenneth Reitz
3483bae24f Update docs/index.rst 2011-12-22 23:09:27 -05:00
Ori Livneh
716d29c49c fix iteration on null responses in safe_mode 2011-12-22 21:10:43 -05:00
Ori Livneh
a7223f86a9 Undo stupid change to while loop 2011-12-22 17:51:22 -05:00
Ori Livneh
2c0ff95d4d Revert "Revert "Make safe_mode play nice with timeout (fixes #312)""
This reverts commit 91766548d1.
2011-12-22 17:50:43 -05:00
Ori Livneh
91766548d1 Revert "Make safe_mode play nice with timeout (fixes #312)"
This reverts commit 805c4db55413c96c5d6e0f95560119c000f660c9.
2011-12-22 17:42:57 -05:00
Ori Livneh
12f3c65e5a Make safe_mode play nice with timeout (fixes #312) 2011-12-22 16:52:29 -05:00
Kenneth Reitz
f5e421e880 1 instead of True
#313
2011-12-22 11:55:55 -05:00
Kenneth Reitz
9d88ac7b50 Merge branch 'develop' of https://github.com/atdt/requests into develop
Conflicts:
	AUTHORS.rst
2011-12-22 11:55:13 -05:00
Kenneth Reitz
75dc012f41 AUTHORS += 'Ori Livneh'
#313
2011-12-22 11:54:07 -05:00
Ori Livneh
f214b91d77 fix bug that causes iter_lines to truncate content
Currently, if the response does not terminate with a newline, iter_lines
truncates the trailing remainder.
2011-12-20 02:01:37 -05:00
Kenneth Reitz
f80fbad4ff Update AUTHORS.rst 2011-12-19 12:25:59 -05:00
Kenneth Reitz
2e38f54b39 Merge pull request #311 from jemerick/patch-1
Add Twitter Streaming API example to Advanced Usage docs
2011-12-19 08:51:15 -08:00
Jason Emerick
2c153c1556 Add Twitter Streaming API example to Advanced Usage docs 2011-12-19 11:45:32 -05:00
Kenneth Reitz
70fbd27d5c Merge commit 'v0.8.6' 2011-12-18 19:19:14 -05:00
Kenneth Reitz
c910b958f0 quotes 2011-12-18 19:18:16 -05:00
Kenneth Reitz
6ce4ece8aa v0.8.6 2011-12-18 19:18:09 -05:00
Kenneth Reitz
5be6c21b14 added @chrisguitarguy to authors.
#309
2011-12-18 19:17:51 -05:00
Kenneth Reitz
8207ed074e keep auth DRY 2011-12-18 19:14:50 -05:00
Kenneth Reitz
f8cf713f41 Merge branch 'proxy_auth' of https://github.com/chrisguitarguy/requests into develop 2011-12-18 19:11:39 -05:00
Kenneth Reitz
8f58c095c5 urllib3 update 2011-12-18 14:10:38 -05:00
Kenneth Reitz
5937282618 pyc importer 2011-12-18 14:07:21 -05:00
Kenneth Reitz
a3b8ef15db urllib3 import 2011-12-18 14:07:12 -05:00
Christopher Davis
4e2ecd6987 Fixed some tab/spaces mixed issues 2011-12-17 13:48:40 -06:00
Christopher Davis
814e0520ad Add Proxy Authorization support 2011-12-17 13:40:04 -06:00
Kenneth Reitz
19a2a6c6d1 Merge branch 'develop' 2011-12-14 10:43:41 -05:00
Kenneth Reitz
0e711f2f9d v0.8.5 2011-12-14 10:43:08 -05:00
Kenneth Reitz
5e60279a19 whitespace 2011-12-14 10:37:46 -05:00
Kenneth Reitz
6fb2674446 iter_lines! 2011-12-14 10:37:40 -05:00
Kenneth Reitz
5a3aae73ba test iter_lines 2011-12-14 10:34:31 -05:00
Kenneth Reitz
47510486ec httpbin reports multiple values now 2011-12-14 10:33:47 -05:00
Kenneth Reitz
c3bba1543b new reqs location 2011-12-14 10:33:29 -05:00
Kenneth Reitz
cef1811415 httpbin v0.0.6 2011-12-14 10:33:22 -05:00
Kenneth Reitz
21acc6b732 newline 2011-12-13 18:23:04 -05:00
Kenneth Reitz
ba71e2a3cb shuffle reqs 2011-12-13 14:37:25 -05:00
Kenneth Reitz
baf3dcb6c7 less 2011-12-12 18:30:45 -05:00
Kenneth Reitz
8b92b6513c trying less toc 2011-12-12 18:29:41 -05:00
Kenneth Reitz
03ddf26596 more assertive 2011-12-11 11:57:50 -05:00
Kenneth Reitz
8c1fd5db95 Merge branch 'develop' 2011-12-11 11:41:42 -05:00
Kenneth Reitz
10eed6344c v0.8.4 2011-12-11 11:39:57 -05:00
Kenneth Reitz
06eee390dd updated notice 2011-12-11 11:39:11 -05:00
Kenneth Reitz
fad9abfd77 Merge remote-tracking branch 'origin/develop' into develop 2011-12-11 11:26:16 -05:00
Kenneth Reitz
a5f79712bb Fix for #303 2011-12-11 11:26:13 -05:00
Kenneth Reitz
c71ac7917a Test for #303 2011-12-11 11:22:33 -05:00
Kenneth Reitz
4e59f9ec93 Merge pull request #305 from oasisbob/develop
Fix spelling errors, typos.
2011-12-11 08:04:26 -08:00
Nick Hatch
a6412b02ba Fix spelling errors, typos. 2011-12-11 01:58:55 -06:00
Kenneth Reitz
961f78ab5f Merge remote-tracking branch 'origin/develop' into develop 2011-12-09 13:23:26 -08:00
Kenneth Reitz
463ca76cc4 colors! 2011-12-09 13:23:16 -08:00
Kenneth Reitz
f58ab8bc03 Update AUTHORS.rst 2011-12-09 08:43:02 -08:00
Kenneth Reitz
3a06c35da3 Merge pull request #301 from cwvh/patch-1
Fixed typo in documentation.
2011-12-09 08:42:18 -08:00
Chris Van Horne
37070ac30e Fixed spelling error in documentation. 2011-12-09 00:48:22 -07:00
Kenneth Reitz
e56d05d230 Update AUTHORS.rst 2011-12-06 18:41:20 -08:00
Kenneth Reitz
f1fa8f0064 Merge pull request #300 from edsu/develop
disable_redirects should be allow_redirects in docs
2011-12-06 18:38:31 -08:00
Ed Summers
56d6d703f9 disable_redirects parameter does not seem to exist anymore, updated docs to point folks at allow_redirects 2011-12-06 21:36:32 -05:00
Kenneth Reitz
7fbbdeb324 Merge remote-tracking branch 'origin/develop' into develop 2011-11-30 12:45:17 -05:00
Kenneth Reitz
f7e4832472 sp 2011-11-30 12:45:13 -05:00
Kenneth Reitz
4ed16d99c2 Merge pull request #294 from failberg/develop
Documentation fix: clarification of keep-alive behavior.
2011-11-29 00:06:54 -08:00
Bryan Berg
02f422d132 Clarification of keep-alive behavior.
The existing behavior was a little opaque for me--I was making a PUT request which returned a HTTP 204 with a 0-byte body. I was never reading the body and was wondering why my connections were not being reused.
2011-11-28 22:55:02 -08:00
Kenneth Reitz
a76f4925b5 didn't mean to save that 2011-11-27 15:07:05 -05:00
Kenneth Reitz
c2e942f230 no .idea ignore 2011-11-27 11:31:48 -05:00
Kenneth Reitz
c7b99f7819 Set Response.sent to True
Fixes #291
2011-11-27 11:29:52 -05:00
Kenneth Reitz
6bb4c4ebe6 Added test for Request.sent.
#291
2011-11-27 11:24:59 -05:00
Kenneth Reitz
d1dfa02070 Merge branch 'develop' 2011-11-27 10:45:19 -05:00
Kenneth Reitz
ee36baf4f3 test tuple'd auth 2011-11-27 10:41:06 -05:00
Kenneth Reitz
e85b857a35 no link to self 2011-11-27 10:37:14 -05:00
Kenneth Reitz
e7ed1224d2 flattr 2011-11-27 10:32:36 -05:00
Kenneth Reitz
9f29a31f66 v0.8.3 2011-11-27 10:08:19 -05:00
Kenneth Reitz
356bf42373 v0.8.3 2011-11-27 10:06:39 -05:00
Kenneth Reitz
ba00c4411c add github buttons to sidebars 2011-11-27 10:00:47 -05:00
Kenneth Reitz
c74b66a53e v0.8.3 2011-11-27 10:00:40 -05:00
Kenneth Reitz
a7a619ba5c Merge branch 'auth_callables' of https://github.com/idangazit/requests into develop
Conflicts:
	requests/models.py
2011-11-26 10:14:14 -05:00
Kenneth Reitz
65c06579b4 Update AUTHORS.rst 2011-11-26 10:10:57 -05:00
Kenneth Reitz
a5ff4be7b0 Merge pull request #283 from rgieseke/develop
Display full URL when logging.
2011-11-26 07:10:08 -08:00
Kenneth Reitz
52ac24120c Merge pull request #287 from sharat87/patch-2
Allow generators or any iterators for async.map
2011-11-26 07:09:37 -08:00
Kenneth Reitz
a77b91671c Merge pull request #288 from sharat87/session-arg
Add use_session argument to request method.
2011-11-25 20:04:24 -08:00
Shrikant Sharat
a350ceffb9 Rename use_session to session. 2011-11-25 11:41:40 +05:30
Shrikant Sharat
5c72601599 Add use_session argument to request method.
This allows usage of an existing session to make a request with the
request and the get, post etc. function.
2011-11-25 08:32:07 +05:30
Shrikant Sharat Kandula
99b6e35940 Allow generators or any iterators for async.map 2011-11-25 07:45:12 +05:30
Robert Gieseke
8ae4b440e3 Display full URL when logging. 2011-11-20 10:14:51 +01:00
Idan Gazit
1933d3c707 Added support for HTTP Basic Auth credentials in 2-tuple 2011-11-19 23:59:27 +02:00
Kenneth Reitz
9d8d1d14f1 package 2011-11-19 16:28:22 -05:00
Kenneth Reitz
42b33ae1a1 Merge branch 'develop' 2011-11-19 16:19:40 -05:00
Kenneth Reitz
ab23536b1b quickstart for encoding 2011-11-19 16:15:48 -05:00
Kenneth Reitz
b51640b051 history :) 2011-11-19 16:13:12 -05:00
Kenneth Reitz
6421ec1784 iter_content uses new encoding system 2011-11-19 16:12:38 -05:00
Kenneth Reitz
296d8cc097 new (elegant) request decoding model.
Closes #282
2011-11-19 16:09:20 -05:00
Kenneth Reitz
bbf1021156 import cleanup 2011-11-19 15:45:45 -05:00
Kenneth Reitz
8ffe17cb09 use monkey patched cookies 2011-11-19 15:43:46 -05:00
Kenneth Reitz
e17155151b backup 2011-11-19 15:42:36 -05:00
Kenneth Reitz
1da54de5dc 2.5 fix 2011-11-19 15:19:56 -05:00
Kenneth Reitz
8693fc746f v0.8.2 2011-11-19 15:18:48 -05:00
Kenneth Reitz
5309ad005f cookies are oreos 2011-11-19 15:15:51 -05:00
Kenneth Reitz
43854067d4 oreos! 2011-11-19 15:15:30 -05:00
Kenneth Reitz
5a7fbbb00d kill all the monkeys 2011-11-19 13:04:10 -05:00
Kenneth Reitz
04ee583822 Update docs/index.rst 2011-11-19 11:56:37 -05:00
Kenneth Reitz
2a7223585e Merge pull request #280 from darkrho/58e018af136190a2c757b13bf9371cecc2d51273
Updated docs with an example of explicit filename in file uploads section
2011-11-18 21:26:08 -08:00
Rolando Espinoza La fuente
58e018af13 updated docs for last change in files argument to support explicit filename. 2011-11-18 18:45:10 -04:00
Rolando Espinoza La fuente
c165255e98 use session's hooks as defaults for every requests. 2011-11-18 18:19:27 -04:00
Kenneth Reitz
cf60062df1 Merge remote-tracking branch 'origin/develop' into develop 2011-11-18 15:34:37 -05:00
Kenneth Reitz
82a5f1dd9b Merge pull request #271 from darkrho/develop
Filenames improvement and cookie fix
2011-11-18 12:34:07 -08:00
Kenneth Reitz
c70b7bb012 Rolando Espinoza La fuente 2011-11-18 15:34:02 -05:00
Kenneth Reitz
16aa01420b Merge branch 'develop' of https://github.com/darkrho/requests into develop 2011-11-18 15:33:20 -05:00
Kenneth Reitz
e98e61da12 Merge pull request #274 from elpres/patch-1
Corrected period to comma.
2011-11-18 12:06:39 -08:00
Kenneth Reitz
cfefcab8e0 Ryan Kelly 2011-11-18 14:48:28 -05:00
Kenneth Reitz
eb5d191a57 Merge branch 'develop' of https://github.com/rfk/requests into develop 2011-11-18 14:44:21 -05:00
Kenneth Reitz
3ea9c53826 best testimonial ever 2011-11-18 13:47:20 -05:00
Ryan Kelly
3900243297 Dont use requote_path when dealing with redirects.
This was breaking redirect locations with a query string, by quoting the
question-mark.  Since the path will be passed through requote_path on
the next request anyway, doing it here seems unnecessary.
2011-11-18 09:03:28 +11:00
Idan Gazit
7fdb09b766 Converted auth to use callable objects instead of tuples.
My attempt to address #275 on kennethreitz/requests.
2011-11-17 13:44:13 +02:00
elpres
81efe1fa88 Corrected period to comma. 2011-11-17 11:31:55 +01:00
Ryan Kelly
f7fdfe8b9a Correct handling of URLs with quoted slashes. 2011-11-17 11:00:02 +11:00
Kenneth Reitz
76dacaf231 homepage update 2011-11-16 18:16:09 -05:00
Rolando Espinoza La fuente
89241c525e use ";" instead "\r\n" as separator for cookies as is better supported
in odd web servers.
2011-11-16 00:04:48 -04:00
Rolando Espinoza La fuente
bf499a80de added support for explicit filenames in files parameter.
files = {
    "files[]": ("myfile", open("foo")),
}
2011-11-16 00:03:19 -04:00
Kenneth Reitz
6b129ec0c9 urllib3 fix 2011-11-15 10:01:37 -05:00
Kenneth Reitz
1165bec773 Merge branch 'develop' 2011-11-15 10:00:05 -05:00
Kenneth Reitz
b79dea97fd v0.8.1 2011-11-15 09:56:21 -05:00
Kenneth Reitz
4504953212 Only send URL path to servers
Closes #256
2011-11-15 09:52:42 -05:00
Kenneth Reitz
2ccc68c4b4 Merge pull request #268 from benmao/develop
fixed: 301 request does not use proxy.
2011-11-15 05:58:10 -08:00
ben
7c66e6f267 fixed: 301 request does not use proxy. 2011-11-15 15:53:38 +08:00
Kenneth Reitz
bec201c5ca Merge pull request #267 from benmao/develop
fixed proxy
2011-11-14 19:04:02 -08:00
ben
35b0c5e16e fixed proxy 2011-11-15 10:59:39 +08:00
Kenneth Reitz
fc0565fa5d Merge pull request #260 from joequery/doc_changes
Doc changes
2011-11-14 13:43:01 -08:00
Kenneth Reitz
289e813ab6 Merge pull request #262 from petermanser/patch-1
Fixing status codes. Somehow these were wrong.
2011-11-14 13:42:24 -08:00
Kenneth Reitz
8a1b0e1852 Merge pull request #264 from pennersr/patch-1
Pass along timeout when following redirects (closes #263)
2011-11-14 13:42:18 -08:00
Raymond Penners
f0edd4a3e0 Pass along timeout when following redirects (closes #263) 2011-11-14 10:04:07 +01:00
Peter Manser
a64a62088a Fixing status codes. Somehow these were wrong. 2011-11-14 09:44:43 +01:00
Joseph McCullough
588b6bbf8a Added OAuth reference to quickstart file 2011-11-14 01:09:12 -06:00
Joseph McCullough
d3cbf37352 Removed closed issues from todo doc 2011-11-14 00:49:11 -06:00
Kenneth Reitz
6b377cc919 grocer's apostrophe 2011-11-13 01:24:29 -05:00
Kenneth Reitz
e91fe9b2b8 stray note 2011-11-13 01:21:58 -05:00
Kenneth Reitz
45c9ecc82a missing param in quick start 2011-11-13 01:21:30 -05:00
Kenneth Reitz
3d49eb40f8 sp 2011-11-13 01:17:27 -05:00
Kenneth Reitz
9f6246a7b8 s 2011-11-13 00:59:22 -05:00
Kenneth Reitz
8f20058d0d Merge branch 'master' of github.com:kennethreitz/requests 2011-11-13 00:51:50 -05:00
Kenneth Reitz
6e9cb09fff Merge branch 'develop' 2011-11-13 00:51:40 -05:00
Kenneth Reitz
9aa62d5622 13th 2011-11-13 00:48:54 -05:00
Kenneth Reitz
bcc48a9607 whatespace 2011-11-13 00:43:14 -05:00
Kenneth Reitz
3458e6a905 upstream urllib3 2011-11-13 00:38:08 -05:00
Kenneth Reitz
0086f97b65 Guess filename.
Closes #192
2011-11-13 00:36:22 -05:00
Kenneth Reitz
06b9d154cc Merge pull request #255 from shazow/patch-1
Adding me into a Urllib3 subsection (as was in urllib3-backup).
2011-11-12 19:52:05 -08:00
Andrey Petrov
e8668fb512 Adding me into a Urllib3 subsection (as was in urllib3-backup). 2011-11-12 18:16:20 -08:00
Kenneth Reitz
b40128219f Merge branch 'develop' 2011-11-12 18:35:39 -05:00
Kenneth Reitz
14a798882c fixes 2011-11-12 18:34:40 -05:00
Kenneth Reitz
37bbdbe8c3 urllib3 in setup.py 2011-11-12 18:34:33 -05:00
Kenneth Reitz
4ab76943ef document timeouts 2011-11-12 18:34:27 -05:00
Kenneth Reitz
30377ca912 redirection docs 2011-11-12 18:23:26 -05:00
Kenneth Reitz
0a24de2ef9 big docs update on workflow of request lifecycle 2011-11-12 18:23:19 -05:00
Kenneth Reitz
3462d9c87b trust built-in if its available 2011-11-12 16:49:08 -05:00
Kenneth Reitz
2584c48e8d python2.5 cookie support 2011-11-12 16:47:40 -05:00
Kenneth Reitz
0a4b7356ac rip 2.7.x collections out 2011-11-12 16:47:14 -05:00
Kenneth Reitz
ec926a4958 test fix 2011-11-12 16:46:53 -05:00
Kenneth Reitz
e84d84b5b8 use new collections MutableMutex 2011-11-12 16:39:18 -05:00
Kenneth Reitz
cfc1a76381 no auto async 2011-11-12 13:14:51 -08:00
Kenneth Reitz
6730818ddc explicit 2011-11-12 13:14:42 -08:00
Kenneth Reitz
7ee2b79127 import async if it's available 2011-11-12 13:08:17 -08:00
Kenneth Reitz
58c77bac27 quicker start 2011-11-12 13:03:29 -08:00
Kenneth Reitz
40c54800a6 file uploads 2011-11-12 13:01:42 -08:00
Kenneth Reitz
3fccf63f49 stylee 2011-11-12 12:58:46 -08:00
Kenneth Reitz
6a23625c11 give Request session reference for parameter+redirects 2011-11-12 12:57:32 -08:00
Kenneth Reitz
474e17b0af remove bunk __all__s 2011-11-12 12:53:23 -08:00
Kenneth Reitz
f1e8700e9a consistiency 2011-11-12 12:51:30 -08:00
Kenneth Reitz
c05c64d21b better defaults 2011-11-12 12:48:45 -08:00
Kenneth Reitz
c0d8e8e846 models cleanup 2011-11-12 12:48:28 -08:00
Kenneth Reitz
58e3dd9de8 fix urllib3 bug 2011-11-12 12:47:21 -08:00
Kenneth Reitz
02408973c6 keep-alive as config option only
better defaults
2011-11-12 12:47:11 -08:00
Kenneth Reitz
df2c80e28e fix form data tests 2011-11-12 12:45:35 -08:00
Kenneth Reitz
60558fdcc4 big quick start updates 2011-11-12 12:39:31 -08:00
Kenneth Reitz
52b9f01e6e kill small css file 2011-11-12 11:30:24 -08:00
Kenneth Reitz
b7bb1c7b61 Merge remote-tracking branch 'origin/develop' into develop 2011-11-12 10:01:42 -08:00
Kenneth Reitz
7c206c74ba Timeouts for urllib3 2011-11-12 10:01:05 -08:00
Kenneth Reitz
50279dd83c Remove timeout configuration 2011-11-12 10:00:30 -08:00
Kenneth Reitz
cdd0613aec Update AUTHORS 2011-11-12 07:45:34 -08:00
Kenneth Reitz
69e7e94c4c updated urllib3 2011-11-12 07:35:55 -08:00
Kenneth Reitz
f5f2ddfa74 throttling 2011-11-12 07:35:41 -08:00
Kenneth Reitz
ff0f9613f2 Merge https://github.com/juanriaza/requests into develop 2011-11-12 07:29:03 -08:00
Kenneth Reitz
30ed6643d7 Merge remote-tracking branch 'origin/develop' into develop 2011-11-12 07:28:26 -08:00
Kenneth Reitz
d9798f4a3c Merge pull request #249 from dasevilla/patch-1
The 'requests-oauth-hook' project was renamed to requests-oauth
2011-11-12 07:19:11 -08:00
Kenneth Reitz
82f2ad6f99 Merge pull request #252 from joequery/fix_doc_typo
Fix various documentation typos
2011-11-11 21:17:21 -08:00
Joseph McCullough
6833b326f8 Fixed gevent reference 2011-11-11 23:15:19 -06:00
Joseph McCullough
afc6561fdb Fixed session API ref typo 2011-11-11 22:17:22 -06:00
Kenneth Reitz
81817852ad Merge pull request #250 from dasevilla/patch-2
Verbose logging example does not work
2011-11-11 14:56:17 -08:00
Devin Sevilla
2d8440ea98 Verbose logging example does not work 2011-11-10 15:34:18 -08:00
Devin Sevilla
a348fd7ae3 The 'requests-oauth-hook' project was renamed to requests-oauth 2011-11-10 15:14:38 -08:00
Kenneth Reitz
1588ad7c46 remove poster 2011-11-09 22:44:58 -08:00
Kenneth Reitz
ae9cdf1a47 options history 2011-11-09 22:18:35 -08:00
Kenneth Reitz
220f687e6f Merge branch 'develop' of https://github.com/jbrendel/requests into develop
Conflicts:
	AUTHORS
	requests/__init__.py
2011-11-09 22:15:54 -08:00
Kenneth Reitz
f4296ba758 Joseph McCullough 2011-11-09 22:01:24 -08:00
Kenneth Reitz
3d6937af7d Merge branch 'develop' of https://github.com/joequery/requests into develop 2011-11-09 21:59:19 -08:00
Kenneth Reitz
fad1c665a6 remove the jar references 2011-11-09 21:36:34 -08:00
Kenneth Reitz
b17ec8e1df yep! 2011-11-09 19:09:11 -08:00
Kenneth Reitz
d1b6db05a4 prefetch handling for _content_consumed 2011-11-09 17:56:29 -08:00
Kenneth Reitz
2999c71e46 more proper prefetch 2011-11-09 17:54:13 -08:00
Kenneth Reitz
0b424e1637 note about prefetch method 2011-11-09 17:52:20 -08:00
Kenneth Reitz
87239802c1 proxy pooling! 2011-11-09 17:50:36 -08:00
Kenneth Reitz
0c4342a3a6 prefetching on all methods 2011-11-09 17:47:19 -08:00
Kenneth Reitz
bd45bc716a add prefetch to main request distpatch 2011-11-09 17:46:19 -08:00
Kenneth Reitz
dfbfb2303f ref 2011-11-09 17:34:59 -08:00
Kenneth Reitz
4002efb56a history 2011-11-09 17:34:21 -08:00
Kenneth Reitz
f7257eada6 Session at root 2011-11-09 17:30:20 -08:00
Kenneth Reitz
02ea563a06 massive css improvements 2011-11-09 17:30:03 -08:00
Kenneth Reitz
341ac9fe8a 800px yo! 2011-11-09 17:26:32 -08:00
Kenneth Reitz
5bc919a24f cross-references in documentation 2011-11-09 17:26:23 -08:00
Kenneth Reitz
a0c3570640 better stepping for elastic design 2011-11-09 17:26:13 -08:00
Kenneth Reitz
ce42b338f4 Configurations 2011-11-09 17:16:03 -08:00
Kenneth Reitz
17088763e7 better advanced quick start 2011-11-09 17:15:54 -08:00
Kenneth Reitz
53bf544050 better api docs 2011-11-09 17:15:44 -08:00
Kenneth Reitz
e725f30625 document defaults 2011-11-09 16:52:27 -08:00
Kenneth Reitz
4e8b680865 explain sessions and keep alive 2011-11-09 16:52:20 -08:00
Kenneth Reitz
92a8db6da0 httplib + urllib3 2011-11-09 16:52:10 -08:00
Kenneth Reitz
2131ba4dda check! 2011-11-09 16:26:36 -08:00
Kenneth Reitz
7a1a40e445 ultra cookie compatibility 2011-11-09 16:26:15 -08:00
Kenneth Reitz
52a95cb93a header and cookie fixes for redirects 2011-11-09 16:24:48 -08:00
Kenneth Reitz
0c4b973dcf keep_alive is now disable-able! 2011-11-09 15:54:24 -08:00
Kenneth Reitz
7192b8022e import ConnectionError 2011-11-09 15:47:09 -08:00
Kenneth Reitz
147c24154e better defaults for "models" 2011-11-09 15:46:45 -08:00
Kenneth Reitz
99f0ef4766 add safe_mode for @bitprophet :) 2011-11-09 15:46:01 -08:00
Kenneth Reitz
35ed9b5f38 dict(o or []) 2011-11-09 15:44:55 -08:00
Kenneth Reitz
0f2dcff725 add query data yourself, foo' 2011-11-09 15:44:14 -08:00
Kenneth Reitz
5b73f2ea61 infos 2011-11-09 15:43:54 -08:00
Kenneth Reitz
1d2abea94b new ConnectionError for bad APIs :) 2011-11-09 15:30:47 -08:00
Kenneth Reitz
6a51f6b2f8 add 'max_retries' configuration 2011-11-09 15:30:33 -08:00
Kenneth Reitz
c48f0d990f Merge branch 'develop' into feature/rewrite
Conflicts:
	requests/__init__.py
	test_requests.py
2011-11-09 15:13:38 -08:00
Kenneth Reitz
f9141f51ec Make sure that session-level cookies work. 2011-11-09 15:04:13 -08:00
Kenneth Reitz
e649003974 test the cookies! 2011-11-09 15:02:53 -08:00
Kenneth Reitz
358478eb88 Cookie persistence! 2011-11-09 14:57:38 -08:00
Kenneth Reitz
498b446f14 Models cleanup 2011-11-09 14:57:00 -08:00
Kenneth Reitz
f5bbb9714d Note about terrible DNS providers for testing 2011-11-09 10:24:41 -05:00
Joseph McCullough
1031ec4942 Reverted GET example back to Github. 2011-11-08 12:10:06 -06:00
Joseph McCullough
827b2340a2 Forgot to delete line mentioning Github in GET section 2011-11-08 02:23:32 -06:00
Joseph McCullough
8de59f03a0 Added POST to quick start. Modified GET in doc to use httpbin 2011-11-08 01:37:39 -06:00
jbrendel
73ba48be2e Added support for OPTIONS method. 2011-11-08 12:31:18 +13:00
Kenneth Reitz
72943d0247 Merge branch 'develop' 2011-11-07 14:21:31 -05:00
Kenneth Reitz
8c90c610cd v0.7.6
Fixes #237
2011-11-07 14:20:32 -05:00
Kenneth Reitz
1a85e110b8 Merge branch 'develop' of github.com:kennethreitz/requests into develop 2011-11-07 14:18:20 -05:00
Kenneth Reitz
12fa108ede add query data to digest path 2011-11-07 14:18:05 -05:00
Kenneth Reitz
9c3ca6e740 The Washington Post 2011-11-07 10:42:10 -05:00
Kenneth Reitz
12ada03548 Merge pull request #244 from neogenix/patch-1
Updated your 2001, to 2011... unless you went back in time ;)
2011-11-06 19:58:34 -08:00
Patrick
daa4fbf4e2 Updated your 2001, to 2011... unless you went back in time ;) 2011-11-06 21:57:47 -06:00
Juan Riaza
6fefffd03e #GH-241 2011-11-06 22:02:14 +01:00
Kenneth Reitz
7ce305fa89 french post 2011-11-06 13:25:34 -05:00
Kenneth Reitz
04cdd0f2e7 daikon 2011-11-06 13:24:23 -05:00
Kenneth Reitz
33ee732082 steal @shazow's contribute paragraph 2011-11-04 23:57:43 -04:00
Kenneth Reitz
d0b96f8e3b Merge branch 'develop' 2011-11-04 23:33:12 -04:00
Kenneth Reitz
cf36d8c753 changes! 2011-11-04 23:32:15 -04:00
Kenneth Reitz
bd562a7ab3 Merge branch 'develop' of https://github.com/davidfischer/requests into develop 2011-11-04 23:28:21 -04:00
Kenneth Reitz
72c8163aee davidfischer 2011-11-04 23:27:50 -04:00
Kenneth Reitz
2bae57e0a6 v0.7.5 2011-11-04 23:26:31 -04:00
Kenneth Reitz
f7968b6797 r.content is None of there's an invalid response.
Fixes #236
2011-11-04 23:24:38 -04:00
Kenneth Reitz
4cae63a297 take out weinre 2011-11-04 23:00:38 -04:00
Kenneth Reitz
628325ae90 Official™ mobile-friendly 2011-11-04 22:58:43 -04:00
Kenneth Reitz
b3e2410f44 mobile auto width 2011-11-04 22:15:54 -04:00
Kenneth Reitz
a02189a8e9 hide rtd on mobile docs 2011-11-04 22:14:12 -04:00
Kenneth Reitz
d343fda7f0 Merge remote-tracking branch 'origin/develop' into develop 2011-11-04 21:59:16 -04:00
Kenneth Reitz
f9bcf7c611 revert 2011-11-04 21:59:12 -04:00
Kenneth Reitz
23b0535a0d Update AUTHORS 2011-11-04 11:51:38 -03:00
Kenneth Reitz
32c7cbf1ad Merge pull request #238 from brutasse/docs-typo
Fixed a broken link in the docs
2011-11-04 07:51:07 -07:00
Bruno Renié
8fe6f8c618 Fixed a broken link in the docs 2011-11-04 15:49:29 +01:00
Kenneth Reitz
80c55f5767 python-rexster 2011-11-03 19:03:11 -03:00
David Fischer
3efd5dbab4 A cleaner and more complete fix for auth/redirects 2011-11-03 08:05:55 -07:00
David Fischer
eaf1264879 Fixes an issue with auth and redirects 2011-11-02 23:29:31 -07:00
Kenneth Reitz
f5592ceb48 Merge remote-tracking branch 'origin/develop' into develop 2011-11-02 20:39:15 -04:00
Kenneth Reitz
e32840f631 fix request docs 2011-11-02 20:39:06 -04:00
Kenneth Reitz
4596c02339 Merge pull request #234 from anatomyofashane/develop
ch ch chcnages
2011-10-31 18:53:07 -07:00
Shane McDonald
4fcf14e124 ch ch chcnages
via @kennethreitz
2011-10-31 21:50:57 -04:00
Kenneth Reitz
797301a63b Merge pull request #233 from anatomyofashane/develop
Update docs/_themes/kr/static/flasky.css_t
2011-10-31 18:26:52 -07:00
anatomyofashane
3615cbc9df Update docs/_themes/kr/static/flasky.css_t 2011-10-31 22:24:59 -03:00
Kenneth Reitz
b8c55da48d stuff and things and stuff 2011-10-27 01:08:51 -04:00
Kenneth Reitz
5b54b3e53f Merge branch 'develop' into feature/rewrite
Conflicts:
	requests/__init__.py
2011-10-27 00:57:03 -04:00
Kenneth Reitz
e43b438729 test fix 2011-10-26 18:42:58 -04:00
Kenneth Reitz
3326030862 Merge branch 'develop' 2011-10-26 18:38:50 -04:00
Kenneth Reitz
8836c4b12a history 2011-10-26 18:38:32 -04:00
Kenneth Reitz
3a4f6ba8b3 v0.7.4 2011-10-26 18:36:14 -04:00
Kenneth Reitz
6ac1e02691 hooks fix #227 2011-10-26 18:35:01 -04:00
Kenneth Reitz
6140fac6aa Default Accept header, a la curl 2011-10-25 16:10:49 -04:00
Kenneth Reitz
a957bcfd7b Merge branch 'develop' into feature/rewrite 2011-10-24 20:55:45 -04:00
Kenneth Reitz
73ed950e70 simplify 2011-10-24 20:55:35 -04:00
Kenneth Reitz
6ef5094be6 Merge remote-tracking branch 'origin/develop' into develop 2011-10-24 20:55:01 -04:00
Kenneth Reitz
077758f713 Merge pull request #224 from stoey/84e89429
Syntax error for Python 2.5
2011-10-24 17:54:05 -07:00
Kenneth Reitz
8b9f689ecc Merge branch 'develop' into feature/rewrite
Conflicts:
	requests/__init__.py
	requests/models.py
2011-10-24 10:09:36 -04:00
Kenneth Reitz
428fc9c0bd PASS ALL TEH TESTS 2011-10-24 01:46:05 -04:00
Kenneth Reitz
d04f31b302 HTTPError 2011-10-23 18:33:27 -04:00
Kenneth Reitz
4673d3dfa7 v0.8.0 2011-10-23 18:28:32 -04:00
Kenneth Reitz
a548b6249d HTTPError 2011-10-23 18:27:54 -04:00
Kenneth Reitz
a9822b0bb6 fix content uploads 2011-10-23 18:24:14 -04:00
Kenneth Reitz
3d3f05884f use new system 2011-10-23 18:15:21 -04:00
Kenneth Reitz
50c39fd95a poolmanager in sessions 2011-10-23 18:15:13 -04:00
Kenneth Reitz
28a9534383 add pool configurations to defaults 2011-10-23 18:15:02 -04:00
Kenneth Reitz
c108c5300f No mo' HttpError 2011-10-23 17:18:46 -04:00
Kenneth Reitz
c60618ae01 Merge branch 'develop' 2011-10-23 16:57:28 -04:00
Kenneth Reitz
0008b035e2 v0.7.3 2011-10-23 16:56:47 -04:00
Kenneth Reitz
be69529dca oops, debugging prints 2011-10-23 16:53:21 -04:00
Kenneth Reitz
dac050bf40 New status_code-based errors 2011-10-23 16:36:53 -04:00
Kenneth Reitz
e7a7615e0d Merge branch 'feature/urllib3-backup' into feature/rewrite 2011-10-23 16:31:41 -04:00
Kenneth Reitz
7c271a466f Import urllib3 2011-10-23 16:18:52 -04:00
Kenneth Reitz
95336a0542 Merge branch 'develop' into feature/rewrite 2011-10-23 16:15:06 -04:00
Kenneth Reitz
e257151ffc Merge branch 'master' into develop 2011-10-23 16:10:24 -04:00
Kenneth Reitz
84a2b35b71 Readme update. 2011-10-23 16:03:06 -04:00
Kenneth Reitz
e15834da8e v0.7.2 2011-10-23 15:40:26 -04:00
Kenneth Reitz
f1bb25b1ec bugfix 2011-10-23 15:39:33 -04:00
Kenneth Reitz
6b9cb059f6 Merge branch 'develop' 2011-10-23 15:21:42 -04:00
Kenneth Reitz
02cf3dce37 v0.7.1 2011-10-23 15:18:27 -04:00
Kenneth Reitz
4fb72a2e68 Merge branch 'feature/detach' into develop 2011-10-23 15:18:09 -04:00
Kenneth Reitz
58b1c69b6a Explain custom auth handlers 2011-10-23 15:13:34 -04:00
Kenneth Reitz
8f8dbec0d5 docs for basic/digest auth 2011-10-23 14:59:46 -04:00
Kenneth Reitz
e46251b727 ch ch changes 2011-10-23 14:52:20 -04:00
Kenneth Reitz
82cbae479c history for this 2011-10-23 14:51:22 -04:00
Kenneth Reitz
b88fbb5e0c KILL THE AUTH HANDLERS 2011-10-23 14:49:59 -04:00
Kenneth Reitz
68b4830948 Add argument injection hook back 2011-10-23 14:47:15 -04:00
Kenneth Reitz
9966017a49 Add new utilities from werkzeug 2011-10-23 14:46:58 -04:00
Kenneth Reitz
53c7b77735 Digest Authentication test. 2011-10-23 14:46:44 -04:00
Kenneth Reitz
491a3c075d Move hooks into internal event loop 2011-10-23 14:46:35 -04:00
Kenneth Reitz
4916b1c2ce pep8 2011-10-23 14:44:26 -04:00
Kenneth Reitz
60b37e54b5 Digest authentication support!
Ripped from urllib2
2011-10-23 14:44:20 -04:00
Kenneth Reitz
b7c788cc56 prettier async patching 2011-10-23 14:44:00 -04:00
Kenneth Reitz
12db1576e9 auth tuple fix 2011-10-23 12:26:46 -04:00
Kenneth Reitz
af6aa3e572 Move hooks out of top-level loop 2011-10-23 12:26:41 -04:00
Kenneth Reitz
20e0ee4968 Remove AuthObject entirely. 2011-10-23 11:35:01 -04:00
Kenneth Reitz
4892a305d9 more advanced authentication mechanism 2011-10-23 11:33:03 -04:00
Kenneth Reitz
495c3d5006 Use new authentication style in models
🤘
2011-10-23 11:15:42 -04:00
Kenneth Reitz
06a5aed8e2 assert sessions are using new auth 2011-10-23 11:15:11 -04:00
Kenneth Reitz
0dae52220b fix base64 encoding for httpbasic 2011-10-23 11:14:59 -04:00
Kenneth Reitz
d23c4b94c1 httpbasic authentication cleanup 2011-10-23 11:00:36 -04:00
Kenneth Reitz
94c587d642 Comment out authentication handlers 2011-10-23 11:00:21 -04:00
Kenneth Reitz
340f7a0733 initial auth module w/ httpbasic auth 2011-10-23 10:56:04 -04:00
Kenneth Reitz
b8d4a5ea61 v0.7.1 plans 2011-10-23 10:04:46 -04:00
Kenneth Reitz
5b5b3def00 Merge branch 'develop' 2011-10-22 22:14:15 -04:00
Kenneth Reitz
1a4dfad52d mod string formatting for 2.5 2011-10-22 21:33:00 -04:00
Kenneth Reitz
b66871e871 v0.7.0 2011-10-22 21:30:47 -04:00
Kenneth Reitz
a74568d8d5 simplify request dispatch flow 2011-10-22 21:10:24 -04:00
Kenneth Reitz
302c4d9c41 Don't alter behavior for safe methods anymore. 2011-10-22 21:01:45 -04:00
Kenneth Reitz
97e3c84084 simplify the URL check 2011-10-22 20:57:39 -04:00
Kenneth Reitz
0ee6c1fa68 kill accept_gzip config 2011-10-22 20:55:46 -04:00
Kenneth Reitz
f0fe8b971b Merge branch 'feature/config' into develop 2011-10-22 20:32:11 -04:00
Kenneth Reitz
8c34fa8477 settings => config 2011-10-22 20:31:51 -04:00
Kenneth Reitz
6be69e303b history for config 2011-10-22 20:29:00 -04:00
Kenneth Reitz
2f6cf50a6c deprecate settings 2011-10-22 20:28:25 -04:00
Kenneth Reitz
f9dfbb73dd requests.request uses config 2011-10-22 20:28:19 -04:00
Kenneth Reitz
903f96cc6a use config throughout models 2011-10-22 20:28:06 -04:00
Kenneth Reitz
5c81fba1eb use config object in sessions 2011-10-22 20:26:12 -04:00
Kenneth Reitz
4dc48b6521 _config => defaults 2011-10-22 20:25:27 -04:00
Kenneth Reitz
ab3200b4cc config.py => _config.py 2011-10-22 19:41:39 -04:00
Kenneth Reitz
185450c5e1 test entry points 2011-10-22 19:40:45 -04:00
Kenneth Reitz
958c424c89 I don't even want to know. 2011-10-22 19:39:23 -04:00
Kenneth Reitz
61be59d996 show both session styles 2011-10-22 19:34:03 -04:00
Kenneth Reitz
e007a5a13f docstring 2011-10-22 19:27:44 -04:00
Kenneth Reitz
3d29f6535f kill wrapping of api methods 2011-10-22 19:27:08 -04:00
Kenneth Reitz
98dc08236c loose yourself 2011-10-22 18:18:39 -04:00
Kenneth Reitz
4ab0bfefd3 Merge branch 'master' into develop 2011-10-22 18:17:04 -04:00
Kenneth Reitz
e418631ce8 Merge branch 'feature/primary-sessions' into develop 2011-10-22 18:16:43 -04:00
Kenneth Reitz
4d97cc7506 disable rudolf until it obeys 2011-10-22 18:16:10 -04:00
Kenneth Reitz
2b3bd78685 Add all methods to session 2011-10-22 18:15:28 -04:00
Kenneth Reitz
597ace5718 import cleanups 2011-10-22 18:13:22 -04:00
Kenneth Reitz
f269c6c89a cookiejar => cookies in models 2011-10-22 18:10:47 -04:00
Kenneth Reitz
d72d116214 Move request and get to session 2011-10-22 18:10:32 -04:00
Kenneth Reitz
d552e6c884 pep8 all the things 2011-10-22 18:07:14 -04:00
Kenneth Reitz
77909f1d49 v0.6.7 2011-10-22 18:07:00 -04:00
Kenneth Reitz
dbf70fc40f All methods are valid now 2011-10-22 18:02:34 -04:00
Kenneth Reitz
3a6d9b09db test improvements 2011-10-22 12:27:10 -04:00
Kenneth Reitz
b19d8785a4 Update AUTHORS 2011-10-21 11:25:02 -03:00
Kenneth Reitz
41e60b8a00 Merge pull request #217 from thedaniel/async-doc
Clarify documentation around async.map and Request.send
2011-10-21 07:24:11 -07:00
Daniel Hengeveld
eddf5254fb Clarify documentation around async.map and Request.send 2011-10-20 23:55:03 -07:00
Kenneth Reitz
ba5eddcf5e WhitespaceBot 2011-10-20 23:53:25 -04:00
Kenneth Reitz
d63cd5f547 periods. 2011-10-20 23:53:20 -04:00
Kenneth Reitz
348d2a2d51 v0.6.7 initial history 2011-10-20 22:43:52 -04:00
Kenneth Reitz
194ff1ad89 #160 2011-10-20 22:09:08 -04:00
Kenneth Reitz
3b6904c5ef Merge branch 'master' into develop 2011-10-20 11:42:09 -04:00
Kenneth Reitz
8d0e03ce41 Merge remote-tracking branch 'origin/develop' into develop 2011-10-20 11:42:00 -04:00
Kenneth Reitz
baa3f78430 Merge pull request #214 from zsiciarz/new_http_codes
New http codes
2011-10-20 08:41:43 -07:00
Zbigniew Siciarz
4f984b0fe6 New HTTP status codes (draft only).
See IETF document at
https://tools.ietf.org/html/draft-nottingham-http-new-status-02.
2011-10-20 17:37:16 +02:00
Kenneth Reitz
c5ed4c9953 Update AUTHORS 2011-10-20 09:46:32 -03:00
Kenneth Reitz
681956e0c4 Merge pull request #213 from fredrikmollerstrand/develop
Fix pip-compared-to-easy-install url
2011-10-20 05:46:16 -07:00
Fredrik Möllerstrand
ad6a8d53d6 docs: fix pip-compared-to-easy-install url. 2011-10-20 11:50:27 +01:00
Kenneth Reitz
0e9d7aad27 add back the ascii art 2011-10-19 16:50:20 -04:00
Kenneth Reitz
6dc664caaf move core imports into __init__.py
because you can't splat import relatively. dumb.
2011-10-19 16:47:46 -04:00
Kenneth Reitz
98c5ded4f3 Merge branch 'master' into develop 2011-10-19 16:36:22 -04:00
Kenneth Reitz
5568f77ad5 Merge branch 'master' into develop 2011-10-19 16:36:12 -04:00
Kenneth Reitz
cfd38263d1 imports cleanup for @alex 🍰 2011-10-19 15:54:22 -04:00
Kenneth Reitz
c052029399 Update AUTHORS 2011-10-19 12:04:34 -03:00
Kenneth Reitz
b7243684de Merge pull request #211 from tvaught/master
Minor doc spelling tweaks
2011-10-19 08:04:04 -07:00
travis
055f7c1eb6 Some Doc and doctoring fixes by the Speling Poleece. 2011-10-19 10:00:13 -05:00
Kenneth Reitz
e27241df73 Update docs/index.rst 2011-10-19 11:41:33 -03:00
Kenneth Reitz
23efd56b12 Merge branch 'develop' 2011-10-19 03:40:39 -04:00
Kenneth Reitz
d938f32089 v0.6.6 2011-10-19 03:39:36 -04:00
Kenneth Reitz
7dc75ce3ce test session persistent params 2011-10-19 03:37:52 -04:00
Kenneth Reitz
8c74860fd1 add params to session merge attributes 2011-10-19 03:32:53 -04:00
Kenneth Reitz
492133ba64 white in spaaaaaccceeee 2011-10-19 01:36:38 -04:00
Kenneth Reitz
82e8fdbb29 Merge branch 'develop' 2011-10-19 01:31:32 -04:00
Kenneth Reitz
b37b977d20 v0.6.5 2011-10-19 01:30:45 -04:00
Kenneth Reitz
ec94f5030c testing session method attribute merging 2011-10-19 01:10:06 -04:00
Kenneth Reitz
65a765fe88 new local merging of keyword arguments for sessions 2011-10-19 01:09:55 -04:00
Kenneth Reitz
9645e882b2 "Python on the Web" blog post 2011-10-18 17:26:21 -04:00
Kenneth Reitz
ef1e27ea9f apt-get install python-requests 2011-10-17 20:59:27 -04:00
Kenneth Reitz
6bd8e9e73f sp 2011-10-17 20:58:52 -04:00
Kenneth Reitz
de4035fb96 ignore junit xml 2011-10-17 20:57:04 -04:00
Kenneth Reitz
38bd234936 pycodeconf audio 2011-10-17 20:56:54 -04:00
Kenneth Reitz
7481980c1a descriptions for "out there" 2011-10-17 20:52:55 -04:00
Kenneth Reitz
a4234e97be Add "out there" section to docs 2011-10-17 20:41:40 -04:00
Kenneth Reitz
9b42c954c6 Offline test suite 2011-10-15 13:01:56 -04:00
Kenneth Reitz
d0b9357f1b all teh colors 2011-10-15 12:54:50 -04:00
Kenneth Reitz
a688f026dc settings are being deprecated 2011-10-15 12:37:08 -04:00
Kenneth Reitz
60917e0b9f timeout adjustment 2011-10-15 12:35:47 -04:00
Kenneth Reitz
f0bcdd075e gunicorn 2011-10-15 12:33:14 -04:00
Kenneth Reitz
7a0f3638b5 Test suite cleanup 2011-10-15 12:32:42 -04:00
Kenneth Reitz
12997080a8 use gunicorn to serve tests 2011-10-15 12:30:49 -04:00
Kenneth Reitz
6e840f46e1 make test 2011-10-15 12:16:24 -04:00
Kenneth Reitz
12d6697815 v0.0.4 2011-10-15 12:05:40 -04:00
Kenneth Reitz
d85c5356dc remove idna tests, for now 2011-10-15 12:05:35 -04:00
Kenneth Reitz
ff6dbc556b Merge branch 'feature/httpbin' into develop 2011-10-15 11:56:20 -04:00
Kenneth Reitz
35bfa9e91d HTTP Integration 2011-10-15 11:55:57 -04:00
Kenneth Reitz
d98de70f4a envoy. 2011-10-15 11:05:29 -04:00
Kenneth Reitz
e1dfb7c883 httpbin 2011-10-15 09:55:00 -04:00
Kenneth Reitz
15755be3c7 nosexunit is a steaming pile of trash 2011-10-15 09:52:45 -04:00
Dan Head
84e89429f0 Syntax fix for Python 2.5 2011-10-14 22:24:42 +00:00
Kenneth Reitz
daf9b60550 gah, gevent won't work with pypy 2011-10-13 22:39:13 -04:00
Kenneth Reitz
1382d655ed omnijson for python2.5 2011-10-13 22:37:23 -04:00
Kenneth Reitz
f0cfba708b take out pyflakes.. for now. 2011-10-13 22:34:01 -04:00
Kenneth Reitz
435bd1242a reqs.txt for ci and dev 2011-10-13 22:30:19 -04:00
Kenneth Reitz
4f6fc98509 Merge branch 'release/0.6.4' 2011-10-13 22:23:04 -04:00
Kenneth Reitz
9011852db0 Bunk submodule. 2011-10-13 22:22:38 -04:00
Kenneth Reitz
29548bfab6 Remove hacking file. 2011-10-13 22:20:43 -04:00
Kenneth Reitz
efc267ce59 Remove deprecated tox configuration. 2011-10-13 22:20:23 -04:00
Kenneth Reitz
244172bdd4 v0.6.4 2011-10-13 22:17:54 -04:00
Kenneth Reitz
f1f56c3081 Remove debian sources. 2011-10-13 22:17:24 -04:00
Kenneth Reitz
bfa010383e Merge pull request #202 from kennethreitz/feature/content-stream
Content Streaming
2011-10-13 19:16:26 -07:00
Kenneth Reitz
daf7aeb8c3 Async API 2011-10-13 22:15:55 -04:00
Kenneth Reitz
573ab095e4 fo => raw 2011-10-13 22:11:50 -04:00
Kenneth Reitz
030d877ed5 v0.6.4 2011-10-13 22:11:42 -04:00
Kenneth Reitz
33dec52b8e merge cleanups 2011-10-13 22:05:57 -04:00
Kenneth Reitz
aa31b6b4dd Merge fixes 2011-10-13 22:02:50 -04:00
Kenneth Reitz
46f0146adf Merge branch 'feature-content-streaming' of https://github.com/mitsuhiko/requests into feature/content-stream
Conflicts:
	AUTHORS
	HISTORY.rst
	docs/api.rst
	docs/community/faq.rst
	docs/user/intro.rst
	requests/api.py
	requests/models.py
2011-10-13 21:54:42 -04:00
Kenneth Reitz
b14fa0764b gevent installation documentation 2011-10-13 21:50:04 -04:00
Kenneth Reitz
15511584d1 Merge branch 'release/0.6.3' 2011-10-13 21:33:55 -04:00
Kenneth Reitz
80cd1ee663 v0.6.3 history 2011-10-13 21:23:42 -04:00
Kenneth Reitz
3161783e49 history fix 2011-10-13 21:19:47 -04:00
Kenneth Reitz
e9b4defe8d Merge pull request #201 from kennethreitz/feature/async
Beautiful Async Module
2011-10-13 18:15:18 -07:00
Kenneth Reitz
a4b87c6fc1 v0.6.3 history 2011-10-13 21:14:31 -04:00
Kenneth Reitz
cc350d54b7 v0.6.3 2011-10-13 21:13:46 -04:00
Kenneth Reitz
3afd07451c prefetch=False for async.map 2011-10-13 21:10:34 -04:00
Kenneth Reitz
27ee6e0f45 Async requests docs 2011-10-13 21:10:25 -04:00
Kenneth Reitz
849934ccd6 Merge branch 'develop' into feature/async 2011-10-13 20:50:22 -04:00
Kenneth Reitz
597f0ae5fd Catch raw socket errors 2011-10-13 20:47:58 -04:00
Kenneth Reitz
2115046bbc Merge branch 'develop' into feature/async 2011-10-13 20:33:55 -04:00
Kenneth Reitz
565745f7b7 Make it so. 2011-10-13 20:33:39 -04:00
Kenneth Reitz
76b8afee94 Make tests go to 11! 2011-10-13 20:33:34 -04:00
Kenneth Reitz
892fcd6cc0 store hooks in Request. 2011-10-13 20:19:59 -04:00
Kenneth Reitz
5537902796 Remove keep_alive cruft from urllib3 (for now) 2011-10-13 20:17:22 -04:00
Kenneth Reitz
9518d053a4 _return_request => return_response 2011-10-13 20:11:25 -04:00
Kenneth Reitz
93c44157ba initial import of urllib3 branch async 2011-10-13 20:11:05 -04:00
Kenneth Reitz
d47522e6fb v0.6.3 plans 2011-10-13 19:54:59 -04:00
Kenneth Reitz
3e233e4856 v0.6.2 in changelog 2011-10-13 19:53:34 -04:00
Kenneth Reitz
b908559ac8 urllib2 => httplib 2011-10-13 19:41:40 -04:00
Kenneth Reitz
4a7fdef3ea Migrate new docs over. 2011-10-13 14:54:36 -04:00
Kenneth Reitz
a0e9b21c9d blargh 2011-10-13 14:34:56 -04:00
Kenneth Reitz
0cfd801f09 Merge pull request #196 from pyos/patch-2
Fix errors introduced by merging an outdated pull request.
2011-10-12 06:34:44 -07:00
Douglas Morrison
c4f013a6f9 Achieve full API compatibility. 2011-10-12 13:21:09 +00:00
Douglas Morrison
20c930e48e Fix errors introduced by merging an outdated pull request.
Don't do that anymore, OK?
2011-10-12 13:00:34 +00:00
Kenneth Reitz
abe33f0ef4 AUTHORS += 'Luca De Vitis' 2011-10-11 08:40:32 -04:00
Kenneth Reitz
3cfc83b23b merge cleanups 2011-10-11 08:39:43 -04:00
Kenneth Reitz
e4c85b318f Merge branch 'develop' of https://github.com/monkeython/requests into develop
Conflicts:
	requests/api.py
	requests/config.py
	requests/models.py
2011-10-11 08:36:35 -04:00
Kenneth Reitz
f524fe4934 python version support update 2011-10-11 08:05:11 -04:00
Kenneth Reitz
fedbafc79b v0.7.0 dev 2011-10-10 21:08:30 -04:00
Kenneth Reitz
4dc48aea63 remove logger for urllib3 2011-10-10 21:08:17 -04:00
Kenneth Reitz
c8f2b3a722 undo ref trickery 2011-10-10 21:05:54 -04:00
Kenneth Reitz
e7b31af784 urllib3 fix 2011-10-10 20:59:10 -04:00
Kenneth Reitz
8fbd6d85e0 Merge remote-tracking branch 'origin/develop' into develop 2011-10-10 20:07:14 -04:00
Kenneth Reitz
8d4afcb5b8 urllib3 upgrade 2011-10-10 20:07:10 -04:00
Kenneth Reitz
a166dd0ad7 Edited AUTHORS via GitHub 2011-10-10 15:58:34 -03:00
Kenneth Reitz
5871291956 Merge pull request #191 from nakajima/patch-1
just fixed a typo
2011-10-10 11:57:57 -07:00
Pat Nakajima
24ffc3610a just fixed a typo 2011-10-10 15:56:58 -03:00
Kenneth Reitz
85507dd042 shorten testimonials a bit 2011-10-10 14:36:32 -04:00
Kenneth Reitz
4ada2e5664 Added Armin's awesome testimonial \o/ 2011-10-10 14:33:35 -04:00
Kenneth Reitz
0cf9ede580 fix builds 2011-10-10 09:58:47 -04:00
Kenneth Reitz
975a183796 --core-target 2011-10-10 09:39:44 -04:00
Kenneth Reitz
7671e3878c blah 2011-10-10 09:20:24 -04:00
Kenneth Reitz
372e4d94c5 pyflakes 2011-10-10 08:56:23 -04:00
Kenneth Reitz
e9f94e698d lost in merge 2011-10-10 01:27:05 -04:00
Kenneth Reitz
9697290111 added nose to reqs 2011-10-09 16:04:00 -04:00
Kenneth Reitz
03babafc7b Weakrefs for Reuqest/Response.
Closes #186
2011-10-09 08:34:13 -04:00
Kenneth Reitz
78b5d9ed45 Fix accidental-merge docstrings 2011-10-09 08:26:42 -04:00
Kenneth Reitz
ba93593711 Merge branch 'master' into develop
Conflicts:
	AUTHORS
	HISTORY.rst
	requests/api.py
	requests/core.py
	requests/models.py
	test_requests.py
2011-10-09 07:16:49 -04:00
Kenneth Reitz
a8695ecd32 v0.6.2 2011-10-09 07:11:48 -04:00
Kenneth Reitz
98c719f714 Merge branch 'redirect-no-follow' of https://github.com/millerdev/requests 2011-10-09 07:05:14 -04:00
Kenneth Reitz
b970d468d1 whoops 2011-10-06 11:58:03 -04:00
Daniel Miller
dda533cf67 Added myself to AUTHORS file 2011-10-05 15:09:57 -04:00
Daniel Miller
aa04cc9b42 Make get and head requests respect allow_redirects=False. 2011-10-05 14:36:12 -04:00
Kenneth Reitz
608d057066 nice and fast nose tests 2011-10-04 11:33:19 -04:00
Kenneth Reitz
04bcb74970 Add a trailing slash for twitter.com 2011-10-04 11:33:11 -04:00
Kenneth Reitz
6e90aa7d65 Merge branch 'refactor-urls' of https://github.com/jerem/requests into develop 2011-10-03 10:11:03 -04:00
Jérémy Bethmont
2361a6fc79 Renamed get_clean_url -> cleanup_url. 2011-10-03 11:16:43 +02:00
Jérémy Bethmont
7077272baa Merge remote-tracking branch 'upstream/develop' into refactor-urls
Conflicts:
	requests/models.py
2011-10-03 11:14:59 +02:00
Kenneth Reitz
0b475dd654 Test improvements
#180
2011-10-01 20:51:41 -04:00
Kenneth Reitz
1997dee3d9 🍰 2011-10-01 06:17:02 -04:00
Kenneth Reitz
e1c0646f95 urllib3 bugfix 2011-10-01 06:04:41 -04:00
Kenneth Reitz
c9f5614417 urllib3 update 2011-10-01 06:04:22 -04:00
Kenneth Reitz
7875a12617 async documentation 2011-10-01 04:52:28 -04:00
Kenneth Reitz
5afe11ba1c async module cleanups 2011-10-01 04:40:53 -04:00
Kenneth Reitz
47b98bc90f Typos
/cc @umbrae
2011-10-01 04:36:50 -04:00
Kenneth Reitz
b58433fb74 ascii arts 2011-10-01 04:35:34 -04:00
Kenneth Reitz
e228cf1cc4 Merge branch 'develop' of github.com:kennethreitz/requests into develop 2011-10-01 03:10:41 -04:00
Kenneth Reitz
3092483433 requests.async. Oh, yes :) 2011-09-30 07:08:59 -04:00
Kenneth Reitz
30d937f299 urllib3 2011-09-30 07:08:38 -04:00
Kenneth Reitz
e8c2fc1585 ch ch ch changes 2011-09-30 07:08:33 -04:00
Kenneth Reitz
2e391fa44c pass hooks around, disable auto send request. 2011-09-30 07:08:04 -04:00
Kenneth Reitz
2f5008107c keepalive => keep_alive 2011-09-30 07:07:39 -04:00
Kenneth Reitz
4cd54d2f87 keepalive => keep_alive 2011-09-30 07:07:09 -04:00
Kenneth Reitz
87e8a12a9f Edited requests/api.py via GitHub 2011-09-29 10:28:00 -03:00
Jérémy Bethmont
ffde764a91 Removed unused imports. 2011-09-26 11:00:25 +02:00
Jérémy Bethmont
62d29d5106 Fixed #174 and refactored urls quoting/concatenation in one function in utils.py. 2011-09-26 10:57:45 +02:00
Kenneth Reitz
5c132c98ca requests cookies behaving 2011-09-26 01:57:31 -04:00
Kenneth Reitz
14bd9ebb45 yay cookies 2011-09-26 01:33:18 -04:00
Kenneth Reitz
2f9e287f7d explicitly 2011-09-26 00:55:36 -04:00
Kenneth Reitz
8ac2fe6eb1 send file name 2011-09-26 00:53:43 -04:00
Kenneth Reitz
1c5ce723d8 multipart file uplaods 2011-09-26 00:38:57 -04:00
Kenneth Reitz
a7d280cb3d cleanup 2011-09-26 00:04:38 -04:00
Kenneth Reitz
111336459e perfection. 2011-09-26 00:01:53 -04:00
Kenneth Reitz
cff3b7f9bd urllib3 update 2011-09-25 22:59:20 -04:00
Kenneth Reitz
cfc19b4dde urllib3, don't decode content 2011-09-25 21:57:21 -04:00
Kenneth Reitz
f52c0032a3 urllib3 update 2011-09-25 21:46:07 -04:00
Kenneth Reitz
dfe0e9382d explaining 2011-09-25 21:44:24 -04:00
Kenneth Reitz
a699ddd14a connection pooling works :D 2011-09-25 21:41:03 -04:00
Kenneth Reitz
ae4e85f11c POOL PARTY!!!!!!!!!!!!!!! 2011-09-25 21:23:04 -04:00
Kenneth Reitz
e2af50b7c9 remove bunk get 2011-09-25 21:09:40 -04:00
Kenneth Reitz
1758070cdc clarity yo 2011-09-25 21:06:41 -04:00
Kenneth Reitz
7881aaa759 clarity™ 2011-09-25 21:05:27 -04:00
Kenneth Reitz
ed160f2d2a rework session argument
Closes #141
2011-09-25 21:02:50 -04:00
Kenneth Reitz
802bcc9ba3 configuration rework 2011-09-25 20:57:29 -04:00
Kenneth Reitz
351a711ce9 cleanup 2011-09-25 20:36:39 -04:00
Kenneth Reitz
0cf0bde158 session work
merge kwargs and such
2011-09-25 20:36:30 -04:00
Kenneth Reitz
dc7b4e7d32 Don't add params to redirect / new configuration 2011-09-25 20:14:32 -04:00
Kenneth Reitz
9488af5a42 cleanups 2011-09-25 19:41:48 -04:00
Kenneth Reitz
bd2b0c45ba simplify 2011-09-25 19:39:21 -04:00
Kenneth Reitz
8565053c93 works for block and non-block connections 2011-09-25 19:01:40 -04:00
Kenneth Reitz
5287b8cd9f fix 2011-09-25 18:57:17 -04:00
Kenneth Reitz
0b22bc9b42 cookie jar => cookies 2011-09-25 18:02:22 -04:00
Kenneth Reitz
182f92ab26 hrmm 2011-09-25 18:00:37 -04:00
Kenneth Reitz
55cea74b56 urllib3 update 2011-09-25 17:42:27 -04:00
Kenneth Reitz
33df9d1bf2 monkeys are deprecated 2011-09-25 17:42:19 -04:00
Kenneth Reitz
37ed9116b7 remove async (for now) 2011-09-25 17:42:13 -04:00
Kenneth Reitz
3af8af5730 remove debían 2011-09-25 17:42:02 -04:00
Kenneth Reitz
0db4dab03e urllib3 updates 2011-09-25 16:05:14 -04:00
Kenneth Reitz
df66fa7975 merge bugs 2011-09-25 16:02:22 -04:00
Kenneth Reitz
d2894b3c58 Merge branch 'develop' into urllib3
Conflicts:
	requests/api.py
	requests/exceptions.py
	requests/models.py
2011-09-25 16:00:44 -04:00
Kenneth Reitz
cd01aa4666 Work for Pie in docs 2011-09-23 03:23:19 -04:00
Kenneth Reitz
74ce263d69 Merge branch 'fixencodings' of https://github.com/jerem/requests into develop 2011-09-22 09:25:06 -04:00
Michael Van Veen
ac9f9b653c Merge branch 'pep8' of github.com:mvanveen/requests into pep8 2011-09-22 03:52:34 -07:00
Michael Van Veen
c48cf2bba8 rearranged imports in core.py 2011-09-22 03:52:05 -07:00
Michael Van Veen
dcebab4c35 PEP8fied all the things
I ran the pep8 checker (version 0.6.1) on the code base and tried to
clean up as many pep8 errors as I could.  Everything except line-width
errors are gone (I was worried about messing up the documentor since I
haven't fiddled with it).
2011-09-22 03:45:41 -07:00
Michael Van Veen
5345a89dc5 added toa AUTHORS file 2011-09-22 03:42:56 -07:00
Jérémy Bethmont
95b0549c75 Ignore unknown encoding. 2011-09-22 11:13:51 +02:00
Kenneth Reitz
04bcab8057 fails 2011-09-18 03:20:11 -04:00
Kenneth Reitz
332f55e552 serious commenting 2011-09-18 01:59:28 -04:00
Kenneth Reitz
7f3f641fb8 super comments! 2011-09-18 01:48:23 -04:00
Kenneth Reitz
18270e1059 cleanups 2011-09-18 01:43:04 -04:00
Kenneth Reitz
645933a5da Gotta catch 'em all! 2011-09-18 01:32:54 -04:00
Kenneth Reitz
2a2e7bd190 pass around connections like pokémon cards 2011-09-18 01:32:37 -04:00
Kenneth Reitz
2d38f51834 kill AuthenticationError 2011-09-18 01:32:00 -04:00
Kenneth Reitz
a3cc97128b Response.fo => Reponse.raw
raise_for_status() fixes
2011-09-17 22:46:17 -04:00
Kenneth Reitz
71d3490bcd optional blocking in urllib3 (for now) 2011-09-17 22:40:30 -04:00
Kenneth Reitz
aa5e477236 basic get request works 2011-09-17 22:02:06 -04:00
Kenneth Reitz
3127a34298 remove invalidmethod 2011-09-17 20:41:10 -04:00
Kenneth Reitz
0cb7376db0 urllib3 in authors 2011-09-17 20:34:30 -04:00
Kenneth Reitz
e69a3a41f6 import urllib3! 2011-09-17 20:32:21 -04:00
Kenneth Reitz
608c61dcd9 remove poster! \o/ 2011-09-17 20:32:13 -04:00
Kenneth Reitz
3dd2a0443d remove notice file 2011-09-17 20:31:56 -04:00
Kenneth Reitz
84434fddee import urllib3 2011-09-17 20:30:08 -04:00
Kenneth Reitz
784b671559 mock reqs for tests 2011-09-17 16:28:51 -04:00
Kenneth Reitz
edfa15558b Merge branch 'feature/improve-test-structure' of https://github.com/mrtazz/requests into develop 2011-09-17 16:24:51 -04:00
Daniel Schauenberg
1481e9ae6a add test with kwargs for api.delete 2011-09-17 17:54:18 +02:00
Daniel Schauenberg
1d1927bb2b add test with kwargs for api.patch 2011-09-17 17:53:49 +02:00
Daniel Schauenberg
42c45df84d add test with kwargs for api.put 2011-09-17 17:53:27 +02:00
Daniel Schauenberg
29f7a5bcfa add test with kwargs for api.post 2011-09-17 17:53:01 +02:00
Daniel Schauenberg
5c5c13a28f add test with kwargs for api.head 2011-09-17 17:52:07 +02:00
Daniel Schauenberg
cb2e87210c add test with kwargs for api.get 2011-09-17 17:50:19 +02:00
Daniel Schauenberg
14081bed46 add unit test for api.request 2011-09-17 17:25:27 +02:00
Kenneth Reitz
2826ca4362 Merge branch 'feature/improve-test-structure' of https://github.com/mrtazz/requests into develop 2011-09-15 22:30:25 -04:00
Daniel Schauenberg
f996313aab move original tests to tests/integration 2011-09-16 00:33:03 +02:00
Daniel Schauenberg
7127bcda97 add basic unit tests for requests.api 2011-09-16 00:32:18 +02:00
Kenneth Reitz
3443ede52a ref to bug in history 2011-09-15 10:09:36 -04:00
Kenneth Reitz
4b93bb4082 history! 2011-09-15 10:08:25 -04:00
Jérémy Bethmont
2a9ae4b367 Fixed #161 (quoting issue). 2011-09-15 11:57:10 +02:00
Kenneth Reitz
a8e77688f0 Merge pull request #150 2011-09-14 08:39:52 -04:00
Kenneth Reitz
34e3c7b68f fix for #160 2011-09-14 08:34:36 -04:00
Kenneth Reitz
c8914bd4d4 X 2011-09-10 20:18:49 -04:00
Kenneth Reitz
1b2533f92d better 2011-09-10 19:54:16 -04:00
Kenneth Reitz
37d269c104 more concise 2011-09-10 19:45:34 -04:00
Kenneth Reitz
d697c37d3e readabilty 2011-09-10 19:43:52 -04:00
Kenneth Reitz
4df5aadb01 ambiguous 2011-09-10 19:40:33 -04:00
Kenneth Reitz
058ef27178 clarify docs version 2011-09-10 19:11:03 -04:00
Kenneth Reitz
ccb9eb28e1 slimming down the repo 2011-09-10 19:03:16 -04:00
Kenneth Reitz
d5a0384630 trailing 2011-09-07 18:41:07 -04:00
Kenneth Reitz
fa47067802 hrm 2011-09-07 18:19:54 -04:00
Kenneth Reitz
45fabf4b96 cleaner setup.py 2011-09-07 18:10:58 -04:00
Kenneth Reitz
46e01db785 Makefile! 2011-09-07 18:10:09 -04:00
Kenneth Reitz
8da0abfa1a that shouldn't be there... 2011-09-07 17:52:46 -04:00
Kenneth Reitz
dd5a39731a Merge branch 'feature/curl' into develop
Conflicts:
	AUTHORS
	HISTORY.rst
2011-09-05 16:27:38 -04:00
Kenneth Reitz
b6aa868c28 Merge branch 'curl_feature' of https://github.com/mawaldne/requests into feature/curl 2011-09-05 16:25:17 -04:00
Kenneth Reitz
724ff7e4fa yep 2011-09-05 16:25:09 -04:00
Kenneth Reitz
1a64a29c84 Merge branch 'fix_redirect' of https://github.com/jerem/requests into develop 2011-09-05 16:22:39 -04:00
Mike Waldner
2aa32c16dc Updated unit tests
#139
2011-09-03 20:54:55 -04:00
Armin Ronacher
0d6773c68c Fail silently if encoding header is missing 2011-09-03 18:04:51 +02:00
Armin Ronacher
41876fd8c6 Implemented content streaming for responses. 2011-09-03 17:59:30 +02:00
verm666
6f84ce72f2 Fixed logic for auto redirect in GET and HEAD methods. 2011-09-02 15:44:18 -04:00
Jérémy Bethmont
824d54f131 Only the path should be encoded (not the query, otherwise it makes a wrong redirection). 2011-09-02 15:06:58 +02:00
Luca De Vitis
07dd324e2f Reverted hooks from sub-package to module. 2011-09-01 18:22:12 +02:00
Kenneth Reitz
6d25fff3f9 Added Josselin Jacquard to AUTHORS 2011-08-30 23:58:31 -04:00
Kenneth Reitz
9bfe04586d Merge branch 'develop' of https://github.com/kigeia/requests into develop 2011-08-30 23:57:24 -04:00
Josselin Jacquard
1ecb593c7b Fix a bug when content-type is empty 2011-08-30 12:04:48 +02:00
Mike Waldner
e46351cfbd Unit Tests for curl_from_request
#139
2011-08-28 23:31:43 -04:00
Mike Waldner
58d63d55bc Sphinx Documentation
#139
2011-08-28 21:19:51 -04:00
Kenneth Reitz
fed17cb58a history 2011-08-28 03:23:54 -04:00
Kenneth Reitz
35fc3b4dbb cleanup 2011-08-28 03:22:46 -04:00
Kenneth Reitz
dba7a5a7e2 shortcut strings 2011-08-28 03:22:20 -04:00
Kenneth Reitz
2fa180e9ea automatic header expansion 2011-08-28 03:22:03 -04:00
Kenneth Reitz
3b9fc987b8 cleanup 2011-08-28 03:09:26 -04:00
Kenneth Reitz
e272ec13c3 tuples too 2011-08-28 03:07:45 -04:00
Kenneth Reitz
b97b4439c0 header expanding 2011-08-28 02:40:19 -04:00
Mike Waldner
3f98034c2a Trailing whitespace
#139
2011-08-25 23:57:56 -04:00
Mike Waldner
3d448f843e Adding cookies
#139
2011-08-25 23:55:24 -04:00
Luca De Vitis
d8c923c385 Added json_content and etree_content, more docs and comments. 2011-08-25 16:28:47 +02:00
Luca De Vitis
3bf6c63d52 Applied new hooks api 2011-08-25 16:26:10 +02:00
Luca De Vitis
335bf7018d default hooks copy fixed 2011-08-25 16:24:55 +02:00
Luca De Vitis
d8fb6d2a5a No more sets in default hooks, code cleanup, more docs and comments. 2011-08-25 16:19:19 +02:00
Luca De Vitis
c243d09398 Added gracefull_hooks, default_hooks and 'Accept-Encoding' base_header 2011-08-25 16:17:38 +02:00
Mike Waldner
7fa4fdacc9 Adding in file support
#139
2011-08-24 22:01:06 -04:00
Mike Waldner
71195bb219 Adding myself to Authors. Small cleanup
#139
2011-08-24 01:50:06 -04:00
Mike Waldner
ec0b708b18 Removing trailing whitespace
#139
2011-08-24 01:40:44 -04:00
Mike Waldner
cfee830877 Renaming vars. String formatting
#139
2011-08-24 01:39:43 -04:00
Mike Waldner
3dd2235ac5 Adding basic authentication. Also string formatting
#139
2011-08-24 01:30:38 -04:00
Mike Waldner
cc2c54093e Adding basic authentication. Also string formatting 2011-08-24 01:21:44 -04:00
Kenneth Reitz
2dfcc0bb7b string formatting
#139
2011-08-24 00:04:18 -04:00
Kenneth Reitz
256c86f8f7 moving curl into utils
#139
2011-08-23 23:54:33 -04:00
Kenneth Reitz
a276ebd240 Merge branch 'curl_feature' of https://github.com/mawaldne/requests into feature/curl 2011-08-23 23:50:56 -04:00
Kenneth Reitz
1d0a5b2665 whitespace 2011-08-23 23:09:51 -04:00
Kenneth Reitz
636e61d68b utils.unicode_from_html 2011-08-23 23:09:09 -04:00
Mike Waldner
0bf60c8876 Adding check when _enc_data in None 2011-08-23 23:08:26 -04:00
Kenneth Reitz
a94541d38c Only decode unicode from http headers
HTTP client, not HTML
#115
2011-08-23 23:03:18 -04:00
Kenneth Reitz
ce3b85a62e unsuccessful 2011-08-23 23:01:35 -04:00
Kenneth Reitz
281aa5ebc4 updated AUTHORS 2011-08-23 23:01:23 -04:00
Mike Waldner
84d9ff0c5c More Small Cleanup 2011-08-23 22:34:05 -04:00
Mike Waldner
68a2954c67 Merge remote-tracking branch 'upstream/develop' into develop 2011-08-23 22:22:51 -04:00
Mike Waldner
c56acf0e32 Small Cleanup 2011-08-23 22:17:36 -04:00
Mike Waldner
2a17e5237c Ive never seen anyone use the --'s unix command options 2011-08-23 22:03:42 -04:00
Luca De Vitis
56406b3442 hooks now comply hook interface 2011-08-23 23:43:40 +02:00
Luca De Vitis
660e090315 Forgot to add the hooks sub-package 2011-08-23 23:39:07 +02:00
Luca De Vitis
d12eac8669 * hooks is a package now.
* Added hooks.setup_hooks to setup multiple and default hooks
* Added hooks.response hooks to unicode encoding, and uncompress response.
* Modified hooks.dispatch_hooks api: don't need a key any more.
2011-08-23 23:30:50 +02:00
Luca De Vitis
2dc556e082 Added multiple hooks support. 2011-08-23 15:06:22 +02:00
jbergstroem
75027f9557 Typos, nits and some 80w fixes 2011-08-23 11:37:51 +02:00
jbergstroem
e8dbecb4db Add test_requests.py to manifest 2011-08-23 11:29:36 +02:00
Kenneth Reitz
317c5b693a _content 2011-08-21 07:12:54 -04:00
Den Shabalin
a86af4477e AUTHORS -= Den Shabalin (I've already been mentioned in the list @ line 41.) 2011-08-21 14:09:03 +03:00
Den Shabalin
59924b9223 Merge branch 'develop' of git://github.com/kennethreitz/requests into develop 2011-08-21 14:06:31 +03:00
Kenneth Reitz
c8110222a5 no need to set content
avoids 2.5 workaround
2011-08-21 07:01:29 -04:00
Kenneth Reitz
1143d4237f AUTHORS += 'Den Shabalin' 2011-08-21 06:59:13 -04:00
Kenneth Reitz
8d5108b142 faq 2011-08-21 06:58:34 -04:00
Den Shabalin
03e18bb7ca Merge branch 'master' of git://github.com/kennethreitz/requests into develop 2011-08-21 12:13:56 +03:00
Den Shabalin
6a96652396 Refactor response.content into a property. This makes content attribute discoverable through dir(response) and also guards from errors like forgetting to raise AttributeError in __getattr__. Also you don't have to create fake self.content to fool Sphinx any more. 2011-08-21 11:57:03 +03:00
Kenneth Reitz
d4bdd84364 new FAQs 2011-08-20 23:00:17 -04:00
Kenneth Reitz
b45b329861 history 2011-08-20 22:55:30 -04:00
Kenneth Reitz
28ee9788a0 Request 2011-08-20 22:51:29 -04:00
Kenneth Reitz
596aceb185 big docs update 2011-08-20 22:47:03 -04:00
Kenneth Reitz
1f3e53b32e yay 2011-08-20 20:05:38 -04:00
Kenneth Reitz
13db806861 docstringin' it up 2011-08-20 20:04:11 -04:00
Kenneth Reitz
d0fdf0eb38 no longer required 2011-08-20 19:59:41 -04:00
Kenneth Reitz
c5d787d6fd cleanups 2011-08-20 19:59:21 -04:00
Kenneth Reitz
873d128c5a docstrings for utils module 2011-08-20 19:58:00 -04:00
Kenneth Reitz
7f35ec7665 r.fo bugfix 2011-08-20 19:52:18 -04:00
Kenneth Reitz
86cc274cf0 remote read/close methods from response 2011-08-20 19:49:23 -04:00
Kenneth Reitz
c19b2c5172 settings.decode_unicode 2011-08-20 19:47:43 -04:00
Kenneth Reitz
4906686186 utils.decode_gzip 2011-08-20 19:46:50 -04:00
Kenneth Reitz
f038ec3b6e may have multiple encoding values 2011-08-20 19:44:24 -04:00
Kenneth Reitz
a609f726e6 settings.allow_unicode 2011-08-20 19:43:36 -04:00
Kenneth Reitz
7bd47777a9 no separate test suite 2011-08-20 19:40:33 -04:00
Kenneth Reitz
21cd47d223 Merge branch 'feature/unicode' into feature/fo
Conflicts:
	AUTHORS
2011-08-20 19:30:46 -04:00
Kenneth Reitz
882ea76aa9 cleanups, response.fo 2011-08-20 19:26:56 -04:00
Kenneth Reitz
850e1c7d40 Merge branch 'develop' of https://github.com/janrito/requests into develop 2011-08-20 19:23:53 -04:00
Kenneth Reitz
01411e37d6 AUTHORS += Alejandro Giacometti 2011-08-20 19:22:48 -04:00
Kenneth Reitz
4922daf498 added Rick Mak to AUTHORS 2011-08-20 19:22:18 -04:00
Kenneth Reitz
8fbb1e6d97 move encoding methods into utils for external consumption 2011-08-20 19:17:41 -04:00
Kenneth Reitz
7fc8c7ccfd move encoding detection out of request object. 2011-08-20 19:17:25 -04:00
Kenneth Reitz
7eb272b299 Merge https://github.com/rickmak/requests into feature/unicode
Conflicts:
	requests/models.py
2011-08-20 18:42:18 -04:00
Kenneth Reitz
8bfa909ff2 merge remnant (oops) 2011-08-20 18:34:33 -04:00
Kenneth Reitz
3b085ed20f Merge branch 'develop' 2011-08-20 18:26:04 -04:00
Kenneth Reitz
8b640979ee v0.6.1 2011-08-20 18:25:32 -04:00
Kenneth Reitz
c58ddff3a4 history update 2011-08-20 18:24:58 -04:00
Alejandro Giacometti
5f16a8a6b1 Added readline method to response object. 2011-08-20 23:05:39 +02:00
Kenneth Reitz
53a53668d9 no more roadmap 2011-08-19 20:59:16 -04:00
Kenneth Reitz
e7d8982583 Merge branch 'feature/jerem' into develop 2011-08-19 20:12:53 -04:00
Kenneth Reitz
abc5e27931 config max_redirects 2011-08-19 20:12:41 -04:00
Kenneth Reitz
c75eaec852 integrate codes into models.py 2011-08-19 20:12:33 -04:00
Kenneth Reitz
d9a349c1a1 303 status code 2011-08-19 20:12:16 -04:00
Kenneth Reitz
9d143ed653 Merge branch 'develop' of https://github.com/jerem/requests into feature/jerem 2011-08-19 19:58:24 -04:00
Kenneth Reitz
ce4927e5d3 added Den Shabalin to AUTHORS 2011-08-19 19:39:53 -04:00
Den Shabalin
17c551539b Merge branch 'master' of github.com:densh/requests into issue-128 2011-08-19 19:20:54 +03:00
Den Shabalin
2f55393593 Fixes an issue #128: `Response not working with lxml''. This error happend due to lxml's attempt to do .geturl() call on the response object. __getattr__ didn't raise AttributeError so response.geturl'' returned None and response.geturl()'' resulted into `TypeError: 'NoneType' object is not callable'' seen in the issue. 2011-08-19 19:18:26 +03:00
Rick Mak
d26f3333e4 Fix tried_encodings scope 2011-08-18 14:42:35 +08:00
Rick Mak
820e2c73e6 Import re 2011-08-18 14:22:54 +08:00
Kenneth Reitz
efbbb84315 Added Mikko Ohtamaa to AUTHORS
#124
2011-08-17 20:17:22 -04:00
Kenneth Reitz
96e7a60b8d Allow any method, if so inclined
#124
2011-08-17 20:15:28 -04:00
Jérémy Bethmont
c22b71fc5b Handle redirection without scheme. 2011-08-17 16:04:53 +02:00
Kenneth Reitz
007963afde authors 2011-08-17 09:45:31 -04:00
Kenneth Reitz
0708736c45 Merge branch 'patch-1' of https://github.com/sharat87/requests into develop 2011-08-17 09:45:23 -04:00
Kenneth Reitz
61d50d531c Authors += Armin 2011-08-17 09:41:24 -04:00
Jérémy Bethmont
a17110b32a Merge remote-tracking branch 'upstream/develop' into develop 2011-08-17 15:32:11 +02:00
Jérémy Bethmont
571d808d25 Fixed bad merge. 2011-08-17 15:31:24 +02:00
Shrikant Sharat Kandula
5e6ecdad9f Typo in documentation
The kwarg is named `headers`, not `header`. Also, its a dict, not a set.
-
Armin Ronacher
91e75f7215 As proposed by @davidbgk this is only consistent with \o/ :) 2011-08-17 13:40:29 +03:00
Kenneth Reitz
81d599786a Merge branch 'develop' 2011-08-17 04:33:34 -04:00
Kenneth Reitz
9471b0ab88 let's do this 2011-08-17 04:32:46 -04:00
Jeremy Selier
470af42bf2 Fixing myself :) 2011-08-17 11:28:47 +03:00
Kenneth Reitz
0b34812afc readme cleanup 2011-08-17 04:23:16 -04:00
Kenneth Reitz
47a36de74e supported interpreters 2011-08-17 04:17:21 -04:00
Kenneth Reitz
0c21aa5530 doc cleanups 2011-08-17 04:16:19 -04:00
Jérémy Bethmont
fe109b27be Merge remote-tracking branch 'upstream/develop' into develop
Conflicts:
	requests/models.py
2011-08-17 10:07:43 +02:00
Kenneth Reitz
3f873dc222 hooks in api layer only 2011-08-17 04:05:20 -04:00
Kenneth Reitz
e0ae2b4155 fixes 2011-08-17 04:03:54 -04:00
Kenneth Reitz
5f603ae787 typo 2011-08-17 04:01:11 -04:00
Kenneth Reitz
d4502aff87 consiserererr 2011-08-17 04:00:12 -04:00
Kenneth Reitz
3992ed6ad1 cookies docs 2011-08-17 03:58:55 -04:00
Kenneth Reitz
b72eb53a73 changing history 2011-08-17 03:25:31 -04:00
Kenneth Reitz
4d0c6cefd0 yawns 2011-08-17 03:21:31 -04:00
Kenneth Reitz
3f8f1dc00c cleaner defaults 2011-08-17 03:19:51 -04:00
Kenneth Reitz
008c77c911 hijack arguments 2011-08-17 03:19:46 -04:00
Kenneth Reitz
77b37687b6 advanced docs 2011-08-17 03:07:24 -04:00
Kenneth Reitz
b7307298d2 merge headers, don't overwrite 2011-08-17 02:49:29 -04:00
Kenneth Reitz
abcf81e2a8 docs update 2011-08-17 02:49:13 -04:00
Kenneth Reitz
e477fce211 add_dict_to_cookiejar
Signed-off-by: Kenneth Reitz <me@kennethreitz.com>
2011-08-17 02:25:56 -04:00
Kenneth Reitz
467766cfe8 cookie session persistence 2011-08-17 02:25:41 -04:00
Kenneth Reitz
66391e5c9d ACTIVVVAATTTEEEEEEE 2011-08-17 02:01:19 -04:00
Kenneth Reitz
f7024a6000 super cookiejar_from_dict powwerrrs 2011-08-17 02:01:13 -04:00
Kenneth Reitz
ec33ce9d29 sp. 2011-08-17 01:32:12 -04:00
Kenneth Reitz
d0aa0175e6 v0.6.0 2011-08-17 01:32:04 -04:00
Kenneth Reitz
d9e5717377 cookiejar_from_dict
#12
2011-08-17 01:29:58 -04:00
Kenneth Reitz
7e255177dc get cookies from response
#116
2011-08-17 01:23:49 -04:00
Kenneth Reitz
b0a0b509da session at root package level 2011-08-17 01:00:00 -04:00
Rick Mak
8c737069a5 Return the r.content as unicode. 2011-08-17 12:49:19 +08:00
Kenneth Reitz
51038497f6 better 2011-08-17 00:40:49 -04:00
Kenneth Reitz
855c273707 whitespace 2011-08-17 00:40:37 -04:00
Kenneth Reitz
281ab5a8f9 move hooks into api layer only 2011-08-17 00:40:28 -04:00
Kenneth Reitz
7836536459 post_request hook 2011-08-17 00:33:28 -04:00
Kenneth Reitz
2a0eff9c71 docstrings 2011-08-17 00:33:21 -04:00
Kenneth Reitz
3e8a14e133 pre_request hook 2011-08-17 00:28:03 -04:00
Kenneth Reitz
8ef0e88220 attach hooks to Request 2011-08-17 00:27:41 -04:00
Kenneth Reitz
e102c1b4ca RTD doesn't work w/ this 2011-08-17 00:17:58 -04:00
Kenneth Reitz
5ba43d0fe5 hook plans 2011-08-17 00:16:57 -04:00
Kenneth Reitz
783e540d6d sigh 2011-08-17 00:09:47 -04:00
Kenneth Reitz
24da41005c hmmm 2011-08-17 00:09:38 -04:00
Kenneth Reitz
17d3e1d498 whitespace 2011-08-17 00:08:39 -04:00
Kenneth Reitz
8d2ab68a97 space 2011-08-17 00:08:06 -04:00
Kenneth Reitz
7322aa5b64 newlines 2011-08-17 00:02:18 -04:00
Kenneth Reitz
6b11cf21f3 todo 2011-08-17 00:00:47 -04:00
Kenneth Reitz
9322d13f61 cleanups 2011-08-16 23:58:55 -04:00
Kenneth Reitz
86a06c5c18 auth_manager internal 2011-08-16 23:58:07 -04:00
Kenneth Reitz
d0cb56932c new hooks system
#118
2011-08-16 23:57:44 -04:00
Kenneth Reitz
fc04d8a368 cleanups 2011-08-16 22:55:18 -04:00
Kenneth Reitz
519b9cee96 relative imports 2011-08-16 22:55:10 -04:00
Kenneth Reitz
efba606e57 doctoring for Session 2011-08-16 22:20:26 -04:00
Kenneth Reitz
5bb18810d4 memory location repr for requests-client 2011-08-16 22:19:49 -04:00
Kenneth Reitz
853383a8d3 docstring fix 2011-08-16 22:16:22 -04:00
Kenneth Reitz
f319006813 session => sessions 2011-08-16 22:15:03 -04:00
Kenneth Reitz
2fa021582b Merge branch 'feature/session' of https://github.com/tomhsx/requests into feature/session
Conflicts:
	AUTHORS
2011-08-16 02:34:44 -04:00
Tom Hogans
0ed641a26e Added docs regarding requests.session to docs/user/advanced.rst 2011-08-16 02:00:11 -04:00
Mike Waldner
aad27218d5 Using build_url and also including headers 2011-08-16 01:39:02 -04:00
Tom Hogans
c2fd568695 Added tests for requests.session 2011-08-16 01:38:39 -04:00
Kenneth Reitz
8f72c48548 added alex to authors 2011-08-15 22:17:55 -04:00
alopatin
08a821381a Fixed misc spelling mistakes. 2011-08-15 22:53:22 -03:00
Kenneth Reitz
4625445d2a Merge branch 'develop' of https://github.com/moliware/requests into develop 2011-08-15 21:50:00 -04:00
Tom Hogans
ca428504d4 Added request.session functionality 2011-08-15 16:01:26 -04:00
JensDiemer
88f79b74ce use settings.timeout_fallback bool for socket.setdefaulttimeout() fallback 2011-08-15 17:03:37 +02:00
JensDiemer
647cdd3847 Use socket.setdefaulttimeout(timeout) only if timeout argument doesn't exist (Python <2.6) - https://github.com/kennethreitz/requests/issues/112 2011-08-15 16:51:33 +02:00
moliware
c510d21e4e headers.update is not the same that add headers one by one with add_header 2011-08-15 11:58:57 +02:00
Mike Waldner
430e87d0fd First commit of curl command from request 2011-08-15 00:12:14 -04:00
Kenneth Reitz
49e5df1ff9 whoops 2011-08-14 22:32:35 -04:00
Kenneth Reitz
2357b13824 Response Headers quickstart 2011-08-14 22:30:30 -04:00
Kenneth Reitz
f137db6803 raise_for_status quick start 2011-08-14 22:20:03 -04:00
Kenneth Reitz
2cf0dad573 models.. 2011-08-14 22:12:50 -04:00
Kenneth Reitz
414b9dde84 not tablib.. 2011-08-14 22:08:01 -04:00
Kenneth Reitz
d50742f059 massive documentation update 2011-08-14 22:07:15 -04:00
Kenneth Reitz
3bc9a181a1 basic FAQ 2011-08-14 21:16:04 -04:00
Kenneth Reitz
975720a30c I'll have to manually add that to sphinx 2011-08-14 15:50:18 -04:00
Kenneth Reitz
1361506ae6 status blocks 2011-08-14 15:44:03 -04:00
Kenneth Reitz
23ff27ea4b Documentation fixes 2011-08-14 11:43:25 -04:00
Kenneth Reitz
933cbd735b emphasize r.content 2011-08-14 11:06:41 -04:00
Kenneth Reitz
ce1945c780 status codes fix 2011-08-14 10:43:02 -04:00
Kenneth Reitz
f52a413b6a Merge branch 'patch-1' of https://github.com/SimonSapin/requests into develop 2011-08-14 10:41:15 -04:00
Kenneth Reitz
ced96912f3 Merge remote-tracking branch 'origin/develop' into develop 2011-08-14 10:40:32 -04:00
Kenneth Reitz
f6e97c322b Merge branch 'develop' of https://github.com/jbochi/requests into develop 2011-08-14 10:39:47 -04:00
Kenneth Reitz
c9d61aefe4 Merge branch 'docs-typos' of https://github.com/markstory/requests into develop 2011-08-14 10:39:35 -04:00
Kenneth Reitz
85c79658ef Merge pull request #108 from zed/patch-1
fix typo
2011-08-14 07:21:52 -07:00
zed
c4c86fd6e8 fix typo 2011-08-14 17:46:43 +04:00
Mark Story
95dcdd8a05 Fixing a small typo. 2011-08-14 09:13:50 -04:00
Juarez Bochi
43669183ce Edited PATCH Requests in README 2011-08-14 07:30:43 -03:00
Simon Sapin
56e58fdcaf Fix a link in the documentation. 2011-08-14 09:50:25 +03:00
Kenneth Reitz
47378164ef \o/ 2011-08-13 14:55:41 -04:00
Kenneth Reitz
9469b4bb69 status_codes lookup dict 2011-08-13 14:50:59 -04:00
Kenneth Reitz
6cead64345 supporting codes class 2011-08-13 14:50:48 -04:00
Kenneth Reitz
773630b010 requests.codes 2011-08-13 14:50:38 -04:00
Kenneth Reitz
907e529471 changing history muahaha 2011-08-13 13:17:41 -04:00
Kenneth Reitz
2d70647f72 attach request object to responses 2011-08-13 13:17:17 -04:00
Kenneth Reitz
10cc4673f9 remove Response.cached 2011-08-13 13:14:10 -04:00
Kenneth Reitz
629d730da6 all main functions are **kwargs now. People shouldn't be relying on the order. 2011-08-13 13:11:16 -04:00
Kenneth Reitz
d4eabaaacc better 2011-08-13 13:04:14 -04:00
Kenneth Reitz
5693314a37 response error handling rework 2011-08-13 13:01:44 -04:00
Kenneth Reitz
2e4724ccea history 2011-08-13 12:34:13 -04:00
Kenneth Reitz
e7084940e1 added Jeremy Selie to AUTHORS 2011-08-13 09:40:24 -04:00
Kenneth Reitz
b141da36a4 test relative redirects 2011-08-13 09:37:14 -04:00
Kenneth Reitz
bb16fe8115 http/https tests 2011-08-13 09:37:07 -04:00
Kenneth Reitz
a987729712 whitespace! 2011-08-13 09:14:49 -04:00
Kenneth Reitz
f7cc7b1778 Merge branch 'patch-1' of https://github.com/jeremys/requests into develop 2011-08-13 08:39:16 -04:00
Jérémy Bethmont
e1909375f5 Merge branch 'memoryleak' into develop
Conflicts:
	requests/models.py
2011-08-09 17:31:26 +02:00
Jérémy Bethmont
cf94c96a68 Always close connection during redirections. 2011-08-09 17:30:19 +02:00
Jérémy Bethmont
e7e395549f Handle too many redirects. 2011-08-09 17:28:58 +02:00
Jérémy Bethmont
e776242de1 Merge branch 'urlencode' into develop 2011-08-09 15:42:18 +02:00
Jérémy Bethmont
7b79cea738 Use urljoin instead of manual concatenation. 2011-08-09 15:41:59 +02:00
Jérémy Bethmont
32a861b2ed Fixed memory leak (see http://bugs.python.org/issue1208304) 2011-08-09 15:34:44 +02:00
Jérémy Bethmont
2ce26d4a1c Merge remote-tracking branch 'upstream/develop' into develop 2011-08-09 15:16:23 +02:00
Jérémy Bethmont
aa0f78b740 Better support of utf-8 paths. 2011-08-09 15:14:08 +02:00
Zbigniew Siciarz
e4adef5226 Added proxies to requests.settings 2011-08-09 10:03:09 +02:00
Jérémy Bethmont
7dc581fad9 Merge branch 'develop' into urlencode 2011-08-08 18:14:08 +02:00
Jérémy Bethmont
0b6dc091f5 Added support for URLs with path not encoded. 2011-08-08 18:11:33 +02:00
Kenneth Reitz
e1714e678e Added Peter Manser to AUTHORS 2011-08-04 22:08:32 -03:00
Kenneth Reitz
d10b08ff88 Merge pull request #99 from petermanser/develop
Fixing minor bug in code example - missing apostrophe
2011-08-04 18:07:49 -07:00
Peter Manser
18c42e88f5 Fixing minor bug in code example - missing apostrophe 2011-08-04 21:47:15 +02:00
Kenneth Reitz
f238dffc18 Merge https://github.com/bclermont/requests into develop 2011-08-02 23:23:41 -04:00
Jeremy Selier
5a7ec361f4 Join with the latest URL not the first one. 2011-08-02 18:51:21 +03:00
Jeremy Selier
291d4742d6 Fixes correct "relative" redirections. Example: http://digg.com/d1qIwX, which redirects to "/news/story/A_Manifesto_How_to_Save_Media", which requests transforms to: http://digg.com//news/story/A_Manifesto_How_to_Save_Media" which results in an endless redirect loop. 2011-08-02 18:05:03 +03:00
Kenneth Reitz
95ba6fcab2 Merge branch 'release/0.5.1' 2011-07-23 22:59:15 -04:00
Kenneth Reitz
1cdd1d04ce v0.5.1 2011-07-23 22:58:32 -04:00
Kenneth Reitz
3293c0e8f4 Python 2.5 bugfix 2011-07-23 22:49:01 -04:00
Kenneth Reitz
074150ff2c test fix 2011-07-23 22:42:51 -04:00
Kenneth Reitz
c3c90bb09c default headers and content encoding settings
Closes #78
2011-07-23 22:35:46 -04:00
Kenneth Reitz
87560d65ca redirect history length test 2011-07-23 22:16:21 -04:00
Kenneth Reitz
7e4f7fa600 added Rubén Abad to AUTHORS 2011-07-23 22:12:41 -04:00
Kenneth Reitz
7f9c6233bb history bugfix in history 2011-07-23 22:12:34 -04:00
Kenneth Reitz
9b6a190652 Merge branch 'develop' of https://github.com/rabad/requests into develop 2011-07-23 22:11:59 -04:00
Kenneth Reitz
1e1fb1e7a8 Redirect history fix (Closes #91) 2011-07-23 22:11:54 -04:00
Kenneth Reitz
080db5ee5d CaseInsensitiveDict notes 2011-07-23 21:49:08 -04:00
Kenneth Reitz
2edda29448 fixing bad url shortner link 2011-07-23 21:48:28 -04:00
Kenneth Reitz
6ba3523a26 Merge branch 'develop' of https://github.com/tgulacsi/requests into develop 2011-07-23 21:45:45 -04:00
Kenneth Reitz
87e7a04209 v0.5.1 history update 2011-07-23 21:42:12 -04:00
Kenneth Reitz
260e32a7c3 default user agent! 2011-07-23 21:39:14 -04:00
Kenneth Reitz
5fff2c757b forced_basic default handler. 2011-07-23 21:37:17 -04:00
Kenneth Reitz
30d699b64f Forced Basic Auth for 404'd resources 2011-07-23 21:36:24 -04:00
Kenneth Reitz
7d91d3fb5c use patched HTTPBasicAuthHandler 2011-07-23 20:10:37 -04:00
Gulácsi Tamás
747f882b0e structures: CaseInsensitiveDict.__delitem__ missing "value" fix 2011-07-23 22:25:07 +02:00
Gulácsi Tamás
369e7cb38f add myself to AUTHORS 2011-07-23 22:19:28 +02:00
Gulácsi Tamás
04c456b877 structures: little bit more general, lower-key-caching version of CaseInsensitiveDict 2011-07-23 22:16:12 +02:00
Gulácsi Tamás
f408829d51 test_request: simplejson is just as good as omnijson for test 2011-07-23 22:15:28 +02:00
Rubén Abad
73b414ab45 We can represent multivalued params with arrays 2011-07-13 11:08:54 +02:00
Kenneth Reitz
f18c40fd36 👍 2011-07-09 10:41:44 -04:00
Jérémy Bethmont
891e52d723 Added the possibility to access headers without fetching the whole body (fixes #86). 2011-06-29 11:10:39 +02:00
Xu Pan
d2ff0f40eb add doseq to urlencode in model._encode_params to enable list as dict value 2011-06-26 13:32:19 +08:00
Kenneth Reitz
787110c853 international domain name support! 2011-06-24 20:32:28 -04:00
Kenneth Reitz
20319044a3 Added Jérémy Bethmont to AUTHORS. 2011-06-24 18:47:41 -04:00
Kenneth Reitz
6f08c81698 note about indns 2011-06-24 18:24:44 -04:00
Jérémy Bethmont
868cd3d1cb Implemented idna (fixes #76). 2011-06-24 12:21:25 +02:00
Kenneth Reitz
39edf7a7fa raise_for_status +URLError 2011-06-23 06:22:46 -04:00
Kenneth Reitz
4cf4362610 typos 2011-06-23 06:06:56 -04:00
Kenneth Reitz
0b719f037c ! 2011-06-23 05:34:44 -04:00
Kenneth Reitz
9603589b06 oops 2011-06-23 05:32:05 -04:00
Kenneth Reitz
5f38c1209e TURTLES 2011-06-23 05:18:13 -04:00
Kenneth Reitz
749edb3554 new sidebar logo 2011-06-23 05:16:13 -04:00
Kenneth Reitz
882b465968 tox fix 2011-06-23 05:15:09 -04:00
Kenneth Reitz
784fe8bbdb working requests logo 2011-06-23 03:30:32 -04:00
Kenneth Reitz
6253cf4c18 TODO Docs 2011-06-23 03:30:22 -04:00
Kenneth Reitz
8521075868 playing nice. 2011-06-21 22:55:35 -04:00
Kenneth Reitz
2d98ca7477 Merge branch 'release/0.5.0' 2011-06-21 22:44:02 -04:00
Kenneth Reitz
e2d6a92150 Timeouts are normal errors now.
--
FIX ALL TEH TESTS!
2011-06-21 22:43:15 -04:00
Kenneth Reitz
162b751f6d Timeouts are normal errors now.
--
BREAK ALL TEH TESTS!
2011-06-21 22:40:27 -04:00
Kenneth Reitz
20aed5488b Release the v0.5.0! 2011-06-21 22:26:06 -04:00
Kenneth Reitz
2374d0fd7a so many paramatersssss 2011-06-21 22:22:46 -04:00
Kenneth Reitz
483d00736c readme update 2011-06-21 22:22:02 -04:00
Kenneth Reitz
15de7d9dba add PATCH to docs 2011-06-21 22:21:54 -04:00
Kenneth Reitz
34a583b821 PATCH in Docs 2011-06-21 22:06:31 -04:00
Kenneth Reitz
2da86daa3a update history 2011-06-21 22:03:56 -04:00
Kenneth Reitz
b4eac4c993 redirect fix 2011-06-21 22:00:04 -04:00
Kenneth Reitz
b4a4f38cce verbose output stream support 2011-06-21 21:59:57 -04:00
Kenneth Reitz
8c81cf64de proper PATCH testing 2011-06-21 18:24:28 -04:00
Kenneth Reitz
00f066a467 PATCH support 2011-06-21 18:03:06 -04:00
Kenneth Reitz
bdf9f90c8a omnijson for tests 2011-06-21 17:59:24 -04:00
Kenneth Reitz
428678b2e4 Added Alberto Paro to AUTHORS 2011-06-21 17:35:29 -04:00
Alberto Paro
bcd30f05ab Added setuptools management to setup.py to allow to install in develop mode 2011-06-21 22:48:31 +02:00
Kenneth Reitz
bd49da067f updated history 2011-06-21 00:07:41 -04:00
moliware
3e7c682e66 Support for proxies 2011-06-19 22:36:50 +02:00
Kenneth Reitz
bbd1e40bd5 no pypy default 2011-06-17 14:09:33 -04:00
Kenneth Reitz
a25f5ff1dd that works 2011-06-17 13:51:29 -04:00
Richard Boulton
80d860d2d4 Allow POST and PUT requests to take both querystring params and request body
data.
2011-06-16 15:48:43 +01:00
Richard Boulton
f31ade335d Change documentation comments for "params" and "data" parameters to refer to
the request body or the query string, as appropriate.  "GET parameters", "POST
data", etc aren't the ideal terminology to use - they come from common usage
with web browsers, rather than the HTTP specification, so are off-putting in
other contexts.
2011-06-16 15:40:14 +01:00
Richard Boulton
023ab755e5 Move the code to encode the request data into a static helper method - I think this makes the code clearer, but it also prepares the way for reusing the encoding code 2011-06-16 13:35:33 +01:00
Richard Boulton
4320f81bf4 Actually use the HTTPSBIN variable for test https requests 2011-06-16 13:06:22 +01:00
Kenneth Reitz
47f1f28385 + Richard Boulton to AUTHOURS 2011-06-16 06:27:13 -04:00
Richard Boulton
3d1444b829 Update documentation of the "data" parameter for requests.post() to indicate that it allows bytes. Update documentation of requests.put() to refer to the "data" parameter rather than the (hidden, but functional) "params" parameter, and note that that also allows both bytes and dictionaries. 2011-06-16 03:18:47 -07:00
Zbigniew Siciarz
4d3a9defd2 Porting cookie test to httpbin.org. 2011-06-16 09:08:32 +02:00
Zbigniew Siciarz
1f1211747b Merge remote-tracking branch 'upstream/develop' into develop 2011-06-16 08:56:38 +02:00
Kenneth Reitz
45e30048f0 port request tests to httpbin.org 2011-06-16 00:11:47 -04:00
Kenneth Reitz
245c6edec3 todo 2011-06-15 22:56:14 -04:00
Kenneth Reitz
cb0a96fbf3 Redirect chain flag default off. 2011-06-15 22:43:26 -04:00
Zbigniew Siciarz
fade9e36b6 Merge branch 'develop' of git://github.com/kennethreitz/requests into develop 2011-06-13 12:41:40 +02:00
Zbigniew Siciarz
24e2a05605 Merge branch 'master' of git://github.com/kennethreitz/requests into develop 2011-06-13 12:41:33 +02:00
Kenneth Reitz
1749260c97 update tests 2011-06-12 22:02:35 -04:00
Kenneth Reitz
3b86c3c0e3 httpbin 2011-06-12 22:00:17 -04:00
Kenneth Reitz
8f3da7b72c added Daniele Tricoli 'Eriol' to authors 2011-06-12 13:14:56 -04:00
Kenneth Reitz
d6cde6a5df add Zbigniew Siciarz to authors 2011-06-09 18:09:39 -04:00
Zbigniew Siciarz
54fd24b757 Testing that cookies actually work. 2011-06-09 12:30:43 +02:00
Kenneth Reitz
2153b21152 less hostility 2011-06-08 19:22:19 -04:00
Kenneth Reitz
74013d751c rackspace cloud's net connection is insane 2011-06-08 19:18:11 -04:00
Kenneth Reitz
1fa1cdd2a3 WHITESPACE 2011-06-08 19:11:08 -04:00
Kenneth Reitz
cd0d0a2b17 whitespace 2011-06-05 21:22:35 -04:00
Kenneth Reitz
e63569041a Update AUTHORS
Refs #46
2011-05-27 08:02:57 -04:00
Kenneth Reitz
54449483b6 Merge branch 'patch-1' of https://github.com/JNRowe/requests into develop 2011-05-27 08:00:22 -04:00
Kenneth Reitz
52bedf4c0b default post data to empty byte string
Refs #45
2011-05-27 07:59:28 -04:00
James Rowe
5962c0ea86 Subclass dict for CaseInsensitiveDict. 2011-05-27 00:17:44 -07:00
Johannes
9b2d7382bf Conform api.* arguments to api.request arguments.
Fixes #40.
Fixes #41.
2011-05-27 08:36:03 +02:00
Bruno Clermont
d91af4cadf add debian packaging 2011-05-26 15:37:31 -04:00
Kenneth Reitz
7e3d265b0f gauge.es 2011-05-24 18:38:45 -04:00
Kenneth Reitz
f990a7b453 Merge branch 'develop' of github.com:kennethreitz/requests into develop 2011-05-24 17:18:28 -04:00
Kenneth Reitz
ef02d02b1f testimonial cleanup 2011-05-24 17:18:19 -04:00
Kenneth Reitz
04c169ecfe Merge pull request #39 from mrtazz/patch-1
e.g. should be i.e. I guess
2011-05-23 08:42:52 -07:00
Daniel Schauenberg
5593f12347 e.g. should be i.e. I guess 2011-05-23 08:39:15 -07:00
Kenneth Reitz
3189d8690e refactor^2 2011-05-22 18:01:21 -04:00
Kenneth Reitz
b51e042e73 Merge pull request #38 from jgorset/requests
---

Ive refactored `api.request`. I think. The new version is more robust in that it no longer accepts arbitrary arguments and raises an exception if one attempts to call it with both `params` and `data` (that should probably be supported, though, but thats a topic for another issue).

Conflicts:
	requests/api.py
2011-05-22 17:54:10 -04:00
Johannes
82f1320ed5 Refactor api.request 2011-05-22 23:49:29 +02:00
Kenneth Reitz
add6feab02 Merge branch 'release/0.4.1' 2011-05-22 14:16:48 -04:00
Kenneth Reitz
670c4aecdd version bump (v0.4.1) 2011-05-22 14:13:49 -04:00
Kenneth Reitz
215d3984cc setup cleanup 2011-05-22 13:58:37 -04:00
Kenneth Reitz
0b36d925f6 remove debug print 2011-05-22 13:56:57 -04:00
Kenneth Reitz
bc290f62d7 defaults 2011-05-22 13:55:13 -04:00
Kenneth Reitz
c0faa9e79c new settings location 2011-05-22 13:31:17 -04:00
Kenneth Reitz
f887906ec3 cleanup — comments 2011-05-22 13:31:09 -04:00
Kenneth Reitz
982fd9d803 new config module 2011-05-22 13:30:55 -04:00
Kenneth Reitz
d64bf501d0 no import packages 2011-05-22 13:30:22 -04:00
Kenneth Reitz
49f1ec1efb settings -> config
reimpliment settings as singleton
2011-05-22 13:27:17 -04:00
Kenneth Reitz
0741448798 pypy binary moved 2011-05-22 12:14:50 -04:00
Kenneth Reitz
8a4d5c4683 useragent 2011-05-22 12:10:56 -04:00
Kenneth Reitz
3cdb777c23 restore allow_redirect behavior 2011-05-22 11:35:01 -04:00
Kenneth Reitz
ddc5452978 Merge pull request #37 from jgorset/requests
---

![Meme](http://i.imgur.com/kXzcW.jpg)
2011-05-22 11:25:31 -04:00
Johannes
8aa6fabd4d Support relative redirects. Fixes #36 2011-05-22 11:41:15 +02:00
Kenneth Reitz
398f5b501f not tablib.. 2011-05-21 16:24:28 -04:00
Kenneth Reitz
8d9bcefa9d Merge pull request #35 from jgorset/requests
---

Ive completed the migration of the requests settings to the new `settings` module, but my attempt to facilitate for manipulating settings outside of the context manager (eg. `requests.settings.timeout = 5`) has been thwarted by the namespace collision of the context manager and the module.

Im probably just being stupid. Youll figure it out.

Conflicts:
	requests/api.py
2011-05-21 13:04:32 -04:00
Kenneth Reitz
0b29964bf8 updated history 2011-05-21 13:00:21 -04:00
Kenneth Reitz
06e662be86 python2.5 with 2011-05-21 12:47:29 -04:00
Kenneth Reitz
e153b94190 Improved redirection behavior for 301/303 2011-05-21 12:44:58 -04:00
Johannes
7d0374df2f Slight refactor 2011-05-20 22:50:50 +02:00
Johannes
2f60748c73 Stop importing inspect 2011-05-20 20:45:51 +02:00
Johannes
bbd58b922b Migrate settings to new module 2011-05-20 20:32:39 +02:00
Kenneth Reitz
21e51b504e no toys 2011-05-20 12:55:36 -04:00
Kenneth Reitz
ba79a2eb97 new settings module 2011-05-20 12:54:42 -04:00
Johannes
ef81c16611 Fix typos 2011-05-20 18:34:43 +02:00
Johannes
da26f1f377 Adjust tests 2011-05-20 18:31:23 +02:00
Johannes
c8cc2d0421 Relocate exceptions 2011-05-20 18:20:17 +02:00
Johannes
a00dc1abf3 Raise Timeout on request timeouts 2011-05-20 18:17:46 +02:00
Johannes
59c747b793 Fix typos 2011-05-19 23:32:27 +02:00
Johannes Gorset
baddc5b6ad Refactor Request#__init__ 2011-05-19 10:16:54 +02:00
Johannes Gorset
637d0330c2 Add test for non-urlencoded post data 2011-05-19 10:14:15 +02:00
Johannes Gorset
21e2d0c34a Add tests for settings 2011-05-19 10:13:42 +02:00
Johannes Gorset
ec5f227381 Refactor settings 2011-05-19 10:13:37 +02:00
Kenneth Reitz
8ffb2462f9 home page url change 2011-05-18 10:11:07 -04:00
Kenneth Reitz
12187155b4 urllib2 2011-05-16 01:38:48 -04:00
Kenneth Reitz
d7f49f3aa5 no quickstart till done 2011-05-16 01:33:33 -04:00
Kenneth Reitz
461497f5be "a kennethreitz project" 2011-05-16 01:31:54 -04:00
Kenneth Reitz
7929bb91be api update 2011-05-16 01:18:09 -04:00
Kenneth Reitz
6e13e7343d Big API update 2011-05-16 01:13:05 -04:00
Kenneth Reitz
f9f3b46ef6 not tablib 2011-05-16 00:10:30 -04:00
Kenneth Reitz
cc851818c2 doc fixes (pretty) 2011-05-15 23:24:25 -04:00
Kenneth Reitz
ba45b9d890 Major docs cleanup 2011-05-15 23:19:19 -04:00
Kenneth Reitz
9fd70c209b GA and CR 2011-05-15 23:00:15 -04:00
Kenneth Reitz
b7970c2a46 config update 2011-05-15 22:58:17 -04:00
Kenneth Reitz
a7d072a7c0 features philosophy 2011-05-15 21:29:49 -04:00
Kenneth Reitz
054891ab5e can/cant 2011-05-15 21:22:40 -04:00
Kenneth Reitz
d18ea48b95 docs update 2011-05-15 21:14:51 -04:00
Kenneth Reitz
d39cde206b installation 2011-05-15 21:01:48 -04:00
Kenneth Reitz
58d5e0318e api.py -> api.rst 2011-05-15 21:01:44 -04:00
Kenneth Reitz
3e23e48239 docs intro 2011-05-15 20:46:36 -04:00
Kenneth Reitz
f1f5788066 docs refactor 2011-05-15 20:46:28 -04:00
Kenneth Reitz
928facfcd9 better links 2011-05-15 20:34:40 -04:00
Kenneth Reitz
70857f3097 example udpate 2011-05-15 20:25:01 -04:00
Kenneth Reitz
da726fc030 webkit scrollbars 2011-05-15 20:24:55 -04:00
Kenneth Reitz
874a874ea6 better index 2011-05-15 17:52:09 -04:00
Kenneth Reitz
0f76e17258 index cleanup 2011-05-15 17:49:59 -04:00
Kenneth Reitz
6b36911260 testimonials 2011-05-15 17:28:16 -04:00
Kenneth Reitz
1ebf3afb24 orgs 2011-05-15 13:23:05 -04:00
Kenneth Reitz
84544b1d01 link fix 2011-05-15 13:14:22 -04:00
Kenneth Reitz
319b570f82 much better index 2011-05-15 13:13:41 -04:00
Kenneth Reitz
f7481adf45 better verbage 2011-05-15 13:05:22 -04:00
Kenneth Reitz
9b165629f9 better title 2011-05-15 13:01:58 -04:00
Kenneth Reitz
79b43b2b6e better 2011-05-15 12:49:19 -04:00
Kenneth Reitz
80b71a03ce initial doc index 2011-05-15 12:43:34 -04:00
Kenneth Reitz
2546bafdde name fix 2011-05-15 11:35:06 -04:00
Kenneth Reitz
d27e4bff1e ignore builds 2011-05-15 00:41:26 -04:00
Kenneth Reitz
27dd96cf3d config update 2011-05-15 00:41:00 -04:00
Kenneth Reitz
3e45e4ba51 added krthemes 2011-05-15 00:38:59 -04:00
Kenneth Reitz
0ee249247a updated history for v0.4.0 2011-05-15 00:00:44 -04:00
Kenneth Reitz
0f520a8c69 Merge branch 'release/0.4.0' into develop 2011-05-14 23:58:07 -04:00
Kenneth Reitz
aa33194606 Merge branch 'release/0.4.0' 2011-05-14 23:58:00 -04:00
Kenneth Reitz
51360e1ede version bump 2011-05-14 23:57:53 -04:00
Kenneth Reitz
af0febe8ad history update 2011-05-14 23:57:19 -04:00
Kenneth Reitz
155863bf71 readme update 2011-05-14 23:55:15 -04:00
Kenneth Reitz
3cec61481c ignore http errors in redirect loops 2011-05-14 23:22:26 -04:00
Kenneth Reitz
5708fe9565 python 2.5 fix 2011-05-14 23:21:58 -04:00
Kenneth Reitz
c40deefb8a cleanup mess 2011-05-14 23:03:31 -04:00
Kenneth Reitz
cd8ce63a3b Custom RedirectHandler and .history support.
Closes #23
2011-05-14 23:01:13 -04:00
Kenneth Reitz
35beda21b8 pass things into the dict 2011-05-14 22:02:14 -04:00
Kenneth Reitz
85b8b2bd44 CaseInsensitiveDict for Headers 2011-05-14 22:02:07 -04:00
Kenneth Reitz
29aa7736ca Headers: Default to None 2011-05-14 21:52:33 -04:00
Kenneth Reitz
e8ff405fce remote async __all__ 2011-05-14 21:50:41 -04:00
Kenneth Reitz
5172d24e66 New CaseInsensitiveDict 2011-05-14 21:50:25 -04:00
Kenneth Reitz
dfe7d877eb date header on history 2011-05-14 14:46:47 -04:00
Kenneth Reitz
0c00a17372 Merge branch 'release/0.3.4' 2011-05-14 14:31:24 -04:00
Kenneth Reitz
fa1db95814 Version bump: v0.3.4 2011-05-14 14:30:36 -04:00
Kenneth Reitz
d77c0ec138 history update 2011-05-14 14:29:41 -04:00
Kenneth Reitz
8ba12ff4f3 cleaner patch names 2011-05-14 14:24:12 -04:00
Kenneth Reitz
14ef462263 package refactor 2011-05-14 14:21:42 -04:00
Kenneth Reitz
1421ffa32a HTTP Basic recursion. Fixes #31 2011-05-14 14:02:36 -04:00
Kenneth Reitz
62931b60f8 history for v0.3.4 2011-05-14 13:11:08 -04:00
Kenneth Reitz
b1e28c7fd8 Added Megan Emurayama to authors 2011-05-14 13:04:49 -04:00
Kenneth Reitz
9b0bb871d2 Merge pull request #29 from meganemura/requests
---

raised Attribute Error when post str data something like json because of not having items attribute.
move encoding data to utf-8 inside hasattr(data, items)
2011-05-12 13:36:45 -04:00
megane murayama
1971bdbe67 fix for post non-dict data 2011-05-12 12:50:09 -04:00
Kenneth Reitz
912f48eece slight refactor 2011-05-12 10:12:04 -04:00
Kenneth Reitz
86fb0cb235 Merge https://github.com/jgorset/requests into develop 2011-05-12 10:09:00 -04:00
Johannes Gorset
23ee58d6ec Encode both keys and values for incoming unicode data as UTF-8, coincidentally fixing a bug that caused UTF-8 encoded byte strings to be encoded twice and causing an UnicodeDecodeError. 2011-05-12 10:27:41 +02:00
Kenneth Reitz
9e0dcae0aa Merge branch 'release/0.3.3' into develop 2011-05-12 04:02:18 -04:00
Kenneth Reitz
7215452da5 Merge branch 'release/0.3.3' 2011-05-12 04:02:16 -04:00
Kenneth Reitz
01b22a7e12 version bump 2011-05-12 04:02:06 -04:00
Kenneth Reitz
d28804cc48 update history 2011-05-12 03:57:17 -04:00
Kenneth Reitz
a046a04aa2 Merge branch 'feature/timeout' into develop 2011-05-12 03:56:13 -04:00
Kenneth Reitz
59dd3ed459 unicode urls 2011-05-12 03:20:27 -04:00
Kenneth Reitz
b6f6048cff Encode incoming data.
Closes #27.
2011-05-12 03:14:09 -04:00
Kenneth Reitz
8a4a05aac0 test for unicode url issues 2011-05-12 03:12:30 -04:00
Kenneth Reitz
64d6c3074f sphinx extension fix 2011-05-12 00:29:31 -04:00
Kenneth Reitz
45ca6d8a78 Merge pull request #26 from jgorset/requests
---

Ive implemented a `settings` context manager as described in [pull request #25](https://github.com/kennethreitz/requests/pull/25#issuecomment-1039541).

    >>> import requests
    >>> with requests.settings(timeout=0.5):
    ...     requests.get(http://example.org) # Times out after 0.5 seconds
    ...     requests.get(http://example.org, timeout=10) # Times out after 10 seconds

Settings may also be manipulated separately:

    >>> import requests
    >>> requests.timeout = 0.5
    >>> requests.get(http://example.org) # Times out after 0.5 seconds
2011-04-21 17:24:43 -04:00
Johannes
77f4b8a75e Implement settings context manager 2011-04-21 18:38:33 +02:00
Kenneth Reitz
122c4f0514 updated history w/ latest changes 2011-04-21 10:37:22 -04:00
Kenneth Reitz
83494152fe Merge branch 'timeout' of https://github.com/jgorset/requests into develop 2011-04-21 10:28:26 -04:00
Kenneth Reitz
f6f636f74c Merge pull request #24 from jgorset/requests
---

I made some insignificant corrections to the README.
2011-04-21 10:16:54 -04:00
Johannes
39e9424f01 Update AUTHORS 2011-04-21 14:55:50 +02:00
Johannes
d93731213a Implement optional timeout for request functions 2011-04-21 14:54:30 +02:00
Johannes
f31dc8a9ef Substitute 'request' for 'requests' 2011-04-21 14:17:02 +02:00
Johannes
4687951a04 Substitute <request object> for the actual return value of the request functions 2011-04-21 14:01:43 +02:00
Kenneth Reitz
576cba81d9 Merge branch 'master' into develop 2011-04-15 18:00:37 -04:00
Kenneth Reitz
d3a46c822f preliminary multidicts 2011-04-15 18:00:10 -04:00
Kenneth Reitz
ea86602765 Merge branch 'release/0.3.2' into develop 2011-04-15 17:29:38 -04:00
Kenneth Reitz
fec0d1a9a0 history changes 2011-04-15 17:29:26 -04:00
Kenneth Reitz
642c667566 Merge branch 'release/0.3.2' 2011-04-15 17:27:17 -04:00
Kenneth Reitz
b8b87d416e install simplejson if python < 2.6 2011-04-15 17:27:02 -04:00
Kenneth Reitz
6e14d4704d version bump 2011-04-15 17:26:51 -04:00
Kenneth Reitz
f494cd9c72 add autoauth tuple http basic test 2011-04-15 17:24:03 -04:00
Kenneth Reitz
2814664e91 Fixes #20. 2011-04-15 17:21:38 -04:00
Kenneth Reitz
1359094cc8 test for gzip decompress 2011-04-14 19:46:35 -04:00
Kenneth Reitz
7a62b10ff2 Automatically decompress gzipped responses if content-type is set. fixes #19 2011-04-14 19:44:29 -04:00
Kenneth Reitz
23d5761bd4 accept any extra args to r.read() 2011-04-02 18:22:05 -04:00
Kenneth Reitz
cc16073c36 Merge branch 'develop' 2011-04-01 14:55:24 -04:00
Kenneth Reitz
ed8ff63048 Version bump to 0.3.1 2011-04-01 14:53:53 -04:00
Kenneth Reitz
267a852ba6 Update history 2011-04-01 14:52:33 -04:00
Kenneth Reitz
f2b04f94ca Response.read() [file like object] 2011-03-31 04:47:02 -04:00
Kenneth Reitz
e350bea167 added Request.read 2011-03-31 04:46:19 -04:00
robmadole
2401f14975 Fixing User-agent header problem introduced with Python 2.7.1 2011-03-30 00:07:24 -05:00
Kenneth Reitz
be228043a1 whitespace fix 2011-03-21 20:45:37 -04:00
Kenneth Reitz
48ffb627fe added Aram Dulyan to authors 2011-03-09 13:22:47 -05:00
Aram Dulyan
89192c64f0 An empty cookiejar evaluates to False, so it needs to be compared to None for the cookie functionality to work. 2011-03-09 22:31:13 +11:00
Kenneth Reitz
a67cc5c5a9 someone stole the cookie jar 2011-03-06 19:19:22 -05:00
Kenneth Reitz
fa2f1c5f60 Merge branch 'develop' of https://github.com/robmadole/requests into develop 2011-03-06 19:08:32 -05:00
Kenneth Reitz
1d021c5cc1 Added Rob Madole to AUTHORS 2011-03-06 19:07:29 -05:00
Kenneth Reitz
e17111a5dd testing requests with poster and adding headers 2011-03-06 18:50:28 -05:00
Kenneth Reitz
9fdee250de Better POSTER header compatibility (Fixes #13) 2011-03-06 18:48:44 -05:00
Kenneth Reitz
c6acfef3d0 Added Justin Murphy to AUTHORS 2011-03-06 18:48:14 -05:00
robmadole
e4c690e7bc Initial support for cookies 2011-03-01 09:21:00 -06:00
robmadole
ee43ad2497 Ignore those compiled files 2011-03-01 09:15:14 -06:00
Kenneth Reitz
044252ea7b Merge branch 'release/0.3.0' 2011-02-25 09:00:23 -05:00
Kenneth Reitz
f8032e08ae tests cleanups 2011-02-25 08:58:24 -05:00
Kenneth Reitz
f0d2ac3dd5 Readme update 2011-02-25 08:58:17 -05:00
Kenneth Reitz
270898e521 Readme Updates 2011-02-25 08:48:09 -05:00
Kenneth Reitz
897dd3aaa8 whitespace 2011-02-25 08:11:17 -05:00
Kenneth Reitz
dd01f8661e hacking whitespace fixes 2011-02-25 08:11:10 -05:00
Kenneth Reitz
99c3970fd3 history 2011-02-25 08:04:03 -05:00
Kenneth Reitz
839c8cf150 postbin tests were broken 2011-02-25 08:00:23 -05:00
Kenneth Reitz
b252cd8403 allow files to be upload along with form data 2011-02-25 08:00:11 -05:00
Kenneth Reitz
b3b2b19212 hmmm 2011-02-25 07:39:19 -05:00
Kenneth Reitz
a74e954788 test improvements 2011-02-25 07:21:11 -05:00
Kenneth Reitz
32f75585ad url builder, cleanups 2011-02-25 07:20:59 -05:00
Kenneth Reitz
9a8b25d5fa makin' history 2011-02-25 07:20:37 -05:00
Kenneth Reitz
14ba99f975 prettier imports 2011-02-25 05:03:12 -05:00
Kenneth Reitz
ccb7fdd8c2 Version bump 2011-02-25 04:48:10 -05:00
Kenneth Reitz
9a1d90d184 Proper async module docs 2011-02-25 04:43:18 -05:00
Kenneth Reitz
22798ca32b Prepping for v0.3.0 release. 2011-02-25 04:40:33 -05:00
Kenneth Reitz
3fe4753d5d Cleanups 2011-02-24 02:06:48 -05:00
Kenneth Reitz
d91157c567 Merge branch 'develop' into merge/xero 2011-02-24 01:53:55 -05:00
Kenneth Reitz
e7b8e9371a merge changes 2011-02-24 01:51:53 -05:00
Kenneth Reitz
1f60e1004c Merge https://github.com/Digitalxero/requests into merge/xero 2011-02-24 01:45:44 -05:00
Kenneth Reitz
9e45d201f3 Added Dj Gilcrease to AUTHORS. 2011-02-24 01:38:58 -05:00
Kenneth Reitz
47ecb3662d !+= 2011-02-24 01:30:00 -05:00
Kenneth Reitz
7369e47f18 Added Flavio to AUTHORS 2011-02-24 01:29:51 -05:00
Flavio Percoco Premoli
6f5b64bca6 small workaround for issue #7 2011-02-23 08:49:08 +01:00
Kenneth Reitz
e788ca7ee6 Safer error response handling. 2011-02-21 14:36:41 -05:00
Kenneth Reitz
68dea921e7 Added HACKING file. 2011-02-21 02:25:01 -05:00
digitalxero
f96157d259 Fix a syntax error on py2.5 and pypy 2011-02-19 15:33:24 -05:00
digitalxero
718f45698d Reset copyright on the async module 2011-02-19 15:21:47 -05:00
digitalxero
15761fc126 Made it so people can add their own auth handlers and not just the 4 provided by Python 2011-02-19 15:07:58 -05:00
digitalxero
edfdef2396 Add in a proper AuthManager instead of the list version that was being used.
Added support for all Auth types that python supports
2011-02-19 15:04:56 -05:00
digitalxero
a9e18e9106 Update the README 2011-02-19 11:18:29 -05:00
digitalxero
3b82b06adc Added an async module to make it explicit to the user that they are using async calls. 2011-02-19 11:13:10 -05:00
digitalxero
d1c89333d0 Remove the eventles code, this should live in requests.async or something so the user explicitly requests it
Clean up the code to get rid of the unnecessary AuthObject class
Cleanup the send method
Cleanup the convenience methods by adding a request method that they all use.
2011-02-19 10:51:54 -05:00
Kenneth Reitz
e26570d0d8 Merge branch 'hotfix/date' into develop 2011-02-19 01:30:22 -05:00
Kenneth Reitz
8b3c4da2c7 Merge branch 'hotfix/date' 2011-02-19 01:30:10 -05:00
Kenneth Reitz
5c4aa1f4b7 history date fix 2011-02-19 01:30:03 -05:00
Kenneth Reitz
d2cdefa7df Merge branch 'release/0.2.4' 2011-02-19 01:03:39 -05:00
Kenneth Reitz
720d0b2c38 Version needs to be available externally. 2011-02-19 01:02:13 -05:00
Kenneth Reitz
d2584ff853 Production Ready! Added Python 2.5 to Support list. 2011-02-19 01:02:01 -05:00
Kenneth Reitz
433452f9f1 Simpler setup.py versioning. 2011-02-19 01:01:51 -05:00
Kenneth Reitz
a34e0bea8b Version Bump (v0.2.4) 2011-02-19 01:00:03 -05:00
Kenneth Reitz
f66b35454f v0.2.4 Release information 2011-02-19 00:59:56 -05:00
Kenneth Reitz
b5c2806e8c Roadmap update 2011-02-19 00:43:27 -05:00
Kenneth Reitz
5072399f7a Import fix for python2.5 2011-02-19 00:41:28 -05:00
Kenneth Reitz
736cb70e9a Merge branch 'develop' of github.com:kennethreitz/requests into develop 2011-02-19 00:38:09 -05:00
Kenneth Reitz
8eafb8d3df Added autoauth tests 2011-02-19 00:37:33 -05:00
Kenneth Reitz
e8234a0137 import fix 2011-02-18 16:13:49 -05:00
Kenneth Reitz
fbe0393eb3 cstring io fix for py3 2011-02-18 16:08:26 -05:00
Kenneth Reitz
b82e72eb04 cStringIO fix. 2011-02-18 16:00:34 -05:00
Kenneth Reitz
a7c87edebe screw 2.4 2011-02-18 15:57:50 -05:00
Kenneth Reitz
7e20f32b02 pypy configuration 2011-02-18 04:41:42 -05:00
Kenneth Reitz
4419e7183f no more test suite 2011-02-18 04:41:34 -05:00
Kenneth Reitz
6bde955170 Python 2.5 Fixes. 2011-02-18 04:39:53 -05:00
Kenneth Reitz
952970f403 Merge branch 'release/0.9.4' 2011-02-18 03:35:18 -05:00
Kenneth Reitz
d3911da653 tox update (usable now?) 2011-02-18 03:32:10 -05:00
Kenneth Reitz
7b6ed48a86 tox setup for 2.4-2.7 2011-02-17 19:38:40 -05:00
Kenneth Reitz
7229dbe033 Making everyone else happy. 2011-02-17 16:22:03 -05:00
Kenneth Reitz
015d6b78d5 cleaning up line lengths 2011-02-17 16:20:53 -05:00
Kenneth Reitz
f4c4bf3d0b Much nicer helper functions and constructors 2011-02-17 16:17:46 -05:00
Kenneth Reitz
efedbd9775 added test_suite.sh for CI 2011-02-17 13:14:03 -05:00
Kenneth Reitz
f4e03a5d32 gitignore update for jenkins 2011-02-17 13:13:52 -05:00
Kenneth Reitz
34ca692c9c from __future__ import absolute_imports 2011-02-16 12:47:58 -05:00
Kenneth Reitz
a5517960ea history indent fix for rest/pypi 2011-02-15 10:02:39 -05:00
Kenneth Reitz
fa42c12e5b I need autodoc. 2011-02-15 09:58:02 -05:00
Kenneth Reitz
8ac29b40e9 new documentation on Request changes. 2011-02-15 09:51:46 -05:00
Kenneth Reitz
adb53c2b4f Merge branch 'release/0.2.3' into develop 2011-02-15 09:46:58 -05:00
93 changed files with 23642 additions and 1640 deletions

2
.coveragerc Normal file
View File

@@ -0,0 +1,2 @@
[run]
omit = requests/packages/*

28
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,28 @@
Summary.
## Expected Result
What you expected.
## Actual Result
What happened instead.
## Reproduction Steps
```python
import requests
```
## System Information
$ python -m requests.help
```
<paste here>
```
This command is only available on Requests v2.16.4 and greater. Otherwise,
please provide some basic information about your system (Python version,
operating system, &c).

25
.gitignore vendored
View File

@@ -1,2 +1,23 @@
.idea
MANIFEST
.coverage
MANIFEST
coverage.xml
nosetests.xml
junit-report.xml
pylint.txt
toy.py
.cache/
cover/
build/
docs/_build
requests.egg-info/
*.pyc
*.swp
*.egg
env/
.workon
t.py
t2.py
dist

31
.travis.yml Normal file
View File

@@ -0,0 +1,31 @@
sudo: false
language: python
python:
- "2.6"
- "2.7"
- "3.4"
- "3.5"
- "3.6"
# - "3.7-dev"
# - "pypy" -- appears to hang
# - "pypy3"
# command to install dependencies
install: "make"
# command to run tests
script:
- |
if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]] ; then make test-readme; fi
- make ci
cache: pip
jobs:
include:
- stage: test
script:
- |
if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]] ; then make test-readme; fi
- make ci
- stage: coverage
python: 3.6
script: codecov

14
AUTHORS
View File

@@ -1,14 +0,0 @@
Requests is written and maintained by Kenneth Reitz and
various contributors:
Development Lead
````````````````
- Kenneth Reitz <me@kennethreitz.com>
Patches and Suggestions
```````````````````````
- Various Pocoo Members
- Chris Adams

180
AUTHORS.rst Normal file
View File

@@ -0,0 +1,180 @@
Requests is written and maintained by Kenneth Reitz and
various contributors:
Keepers of the Four Crystals
````````````````````````````
- Kenneth Reitz <me@kennethreitz.org> `@kennethreitz <https://github.com/kennethreitz>`_, Keeper of the Master Crystal.
- Cory Benfield <cory@lukasa.co.uk> `@lukasa <https://github.com/lukasa>`_
- Ian Cordasco <graffatcolmingov@gmail.com> `@sigmavirus24 <https://github.com/sigmavirus24>`_
- Nate Prewitt <nate.prewitt@gmail.com> `@nateprewitt <https://github.com/nateprewitt>`_
Patches and Suggestions
```````````````````````
- Various Pocoo Members
- Chris Adams
- Flavio Percoco Premoli
- Dj Gilcrease
- Justin Murphy
- Rob Madole
- Aram Dulyan
- Johannes Gorset
- 村山めがね (Megane Murayama)
- James Rowe
- Daniel Schauenberg
- Zbigniew Siciarz
- Daniele Tricoli 'Eriol'
- Richard Boulton
- Miguel Olivares <miguel@moliware.com>
- Alberto Paro
- Jérémy Bethmont
- 潘旭 (Xu Pan)
- Tamás Gulácsi
- Rubén Abad
- Peter Manser
- Jeremy Selier
- Jens Diemer
- Alex (`@alopatin <https://github.com/alopatin>`_)
- Tom Hogans <tomhsx@gmail.com>
- Armin Ronacher
- Shrikant Sharat Kandula
- Mikko Ohtamaa
- Den Shabalin
- Daniel Miller <danielm@vs-networks.com>
- Alejandro Giacometti
- Rick Mak
- Johan Bergström
- Josselin Jacquard
- Travis N. Vaught
- Fredrik Möllerstrand
- Daniel Hengeveld
- Dan Head
- Bruno Renié
- David Fischer
- Joseph McCullough
- Juergen Brendel
- Juan Riaza
- Ryan Kelly
- Rolando Espinoza La fuente
- Robert Gieseke
- Idan Gazit
- Ed Summers
- Chris Van Horne
- Christopher Davis
- Ori Livneh
- Jason Emerick
- Bryan Helmig
- Jonas Obrist
- Lucian Ursu
- Tom Moertel
- Frank Kumro Jr
- Chase Sterling
- Marty Alchin
- takluyver
- Ben Toews (`@mastahyeti <https://github.com/mastahyeti>`_)
- David Kemp
- Brendon Crawford
- Denis (`@Telofy <https://github.com/Telofy>`_)
- Matt Giuca
- Adam Tauber
- Honza Javorek
- Brendan Maguire <maguire.brendan@gmail.com>
- Chris Dary
- Danver Braganza <danverbraganza@gmail.com>
- Max Countryman
- Nick Chadwick
- Jonathan Drosdeck
- Jiri Machalek
- Steve Pulec
- Michael Kelly
- Michael Newman <newmaniese@gmail.com>
- Jonty Wareing <jonty@jonty.co.uk>
- Shivaram Lingamneni
- Miguel Turner
- Rohan Jain (`@crodjer <https://github.com/crodjer>`_)
- Justin Barber <barber.justin@gmail.com>
- Roman Haritonov (`@reclosedev <https://github.com/reclosedev>`_)
- Josh Imhoff <joshimhoff13@gmail.com>
- Arup Malakar <amalakar@gmail.com>
- Danilo Bargen (`@dbrgn <https://github.com/dbrgn>`_)
- Torsten Landschoff
- Michael Holler (`@apotheos <https://github.com/apotheos>`_)
- Timnit Gebru
- Sarah Gonzalez
- Victoria Mo
- Leila Muhtasib
- Matthias Rahlf <matthias@webding.de>
- Jakub Roztocil <jakub@roztocil.name>
- Rhys Elsmore
- André Graf (`@dergraf <https://github.com/dergraf>`_)
- Stephen Zhuang (`@everbird <https://github.com/everbird>`_)
- Martijn Pieters
- Jonatan Heyman
- David Bonner <dbonner@gmail.com> (`@rascalking <https://github.com/rascalking>`_)
- Vinod Chandru
- Johnny Goodnow <j.goodnow29@gmail.com>
- Denis Ryzhkov <denisr@denisr.com>
- Wilfred Hughes <me@wilfred.me.uk>
- Dmitry Medvinsky <me@dmedvinsky.name>
- Bryce Boe <bbzbryce@gmail.com> (`@bboe <https://github.com/bboe>`_)
- Colin Dunklau <colin.dunklau@gmail.com> (`@cdunklau <https://github.com/cdunklau>`_)
- Bob Carroll <bob.carroll@alum.rit.edu> (`@rcarz <https://github.com/rcarz>`_)
- Hugo Osvaldo Barrera <hugo@osvaldobarrera.com.ar> (`@hobarrera <https://github.com/hobarrera>`_)
- Łukasz Langa <lukasz@langa.pl>
- Dave Shawley <daveshawley@gmail.com>
- James Clarke (`@jam <https://github.com/jam>`_)
- Kevin Burke <kev@inburke.com>
- Flavio Curella
- David Pursehouse <david.pursehouse@gmail.com> (`@dpursehouse <https://github.com/dpursehouse>`_)
- Jon Parise (`@jparise <https://github.com/jparise>`_)
- Alexander Karpinsky (`@homm86 <https://twitter.com/homm86>`_)
- Marc Schlaich (`@schlamar <https://github.com/schlamar>`_)
- Park Ilsu <daftonshady@gmail.com> (`@daftshady <https://github.com/daftshady>`_)
- Matt Spitz (`@mattspitz <https://github.com/mattspitz>`_)
- Vikram Oberoi (`@voberoi <https://github.com/voberoi>`_)
- Can Ibanoglu <can.ibanoglu@gmail.com> (`@canibanoglu <https://github.com/canibanoglu>`_)
- Thomas Weißschuh <thomas@t-8ch.de> (`@t-8ch <https://github.com/t-8ch>`_)
- Jayson Vantuyl <jayson@aggressive.ly>
- Pengfei.X <pengphy@gmail.com>
- Kamil Madac <kamil.madac@gmail.com>
- Michael Becker <mike@beckerfuffle.com> (`@beckerfuffle <https://twitter.com/beckerfuffle>`_)
- Erik Wickstrom <erik@erikwickstrom.com> (`@erikwickstrom <https://github.com/erikwickstrom>`_)
- Константин Подшумок (`@podshumok <https://github.com/podshumok>`_)
- Ben Bass (`@codedstructure <https://github.com/codedstructure>`_)
- Jonathan Wong <evolutionace@gmail.com> (`@ContinuousFunction <https://github.com/ContinuousFunction>`_)
- Martin Jul (`@mjul <https://github.com/mjul>`_)
- Joe Alcorn (`@buttscicles <https://github.com/buttscicles>`_)
- Syed Suhail Ahmed <ssuhail.ahmed93@gmail.com> (`@syedsuhail <https://github.com/syedsuhail>`_)
- Scott Sadler (`@ssadler <https://github.com/ssadler>`_)
- Arthur Darcet (`@arthurdarcet <https://github.com/arthurdarcet>`_)
- Ulrich Petri (`@ulope <https://github.com/ulope>`_)
- Muhammad Yasoob Ullah Khalid <yasoob.khld@gmail.com> (`@yasoob <https://github.com/yasoob>`_)
- Paul van der Linden (`@pvanderlinden <https://github.com/pvanderlinden>`_)
- Colin Dickson (`@colindickson <https://github.com/colindickson>`_)
- Smiley Barry (`@smiley <https://github.com/smiley>`_)
- Shagun Sodhani (`@shagunsodhani <https://github.com/shagunsodhani>`_)
- Robin Linderborg (`@vienno <https://github.com/vienno>`_)
- Brian Samek (`@bsamek <https://github.com/bsamek>`_)
- Dmitry Dygalo (`@Stranger6667 <https://github.com/Stranger6667>`_)
- piotrjurkiewicz
- Jesse Shapiro <jesse@jesseshapiro.net> (`@haikuginger <https://github.com/haikuginger>`_)
- Nate Prewitt <nate.prewitt@gmail.com> (`@nateprewitt <https://github.com/nateprewitt>`_)
- Maik Himstedt
- Michael Hunsinger
- Brian Bamsch <bbamsch32@gmail.com> (`@bbamsch <https://github.com/bbamsch>`_)
- Om Prakash Kumar <omprakash070@gmail.com> (`@iamprakashom <https://github.com/iamprakashom>`_)
- Philipp Konrad <gardiac2002@gmail.com> (`@gardiac2002 <https://github.com/gardiac2002>`_)
- Hussain Tamboli <hussaintamboli18@gmail.com> (`@hussaintamboli <https://github.com/hussaintamboli>`_)
- Casey Davidson (`@davidsoncasey <https://github.com/davidsoncasey>`_)
- Andrii Soldatenko (`@a_soldatenko <https://github.com/andriisoldatenko>`_)
- Moinuddin Quadri <moin18@gmail.com> (`@moin18 <https://github.com/moin18>`_)
- Matt Kohl (`@mattkohl <https://github.com/mattkohl>`_)
- Jonathan Vanasco (`@jvanasco <https://github.com/jvanasco>`_)
- David Fontenot (`@davidfontenot <https://github.com/davidfontenot>`_)
- Shmuel Amar (`@shmuelamar <https://github.com/shmuelamar>`_)
- Gary Wu (`@garywu <https://github.com/garywu>`_)
- Ryan Pineo (`@ryanpineo <https://github.com/ryanpineo>`_)
- Ed Morley (`@edmorley <https://github.com/edmorley>`_)
- Matt Liu <liumatt@gmail.com> (`@mlcrazy <https://github.com/mlcrazy>`_)

3
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,3 @@
Be cordial or be on your way.
https://www.kennethreitz.org/essays/be-cordial-or-be-on-your-way

57
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,57 @@
# Contribution Guidelines
Before opening any issues or proposing any pull requests, please do the
following:
1. Read our [Contributor's Guide](http://docs.python-requests.org/en/latest/dev/contributing/).
2. Understand our [development philosophy](http://docs.python-requests.org/en/latest/dev/philosophy/).
To get the greatest chance of helpful responses, please also observe the
following additional notes.
## Questions
The GitHub issue tracker is for *bug reports* and *feature requests*. Please do
not use it to ask questions about how to use Requests. These questions should
instead be directed to [Stack Overflow](https://stackoverflow.com/). Make sure
that your question is tagged with the `python-requests` tag when asking it on
Stack Overflow, to ensure that it is answered promptly and accurately.
## Good Bug Reports
Please be aware of the following things when filing bug reports:
1. Avoid raising duplicate issues. *Please* use the GitHub issue search feature
to check whether your bug report or feature request has been mentioned in
the past. Duplicate bug reports and feature requests are a huge maintenance
burden on the limited resources of the project. If it is clear from your
report that you would have struggled to find the original, that's ok, but
if searching for a selection of words in your issue title would have found
the duplicate then the issue will likely be closed extremely abruptly.
2. When filing bug reports about exceptions or tracebacks, please include the
*complete* traceback. Partial tracebacks, or just the exception text, are
not helpful. Issues that do not contain complete tracebacks may be closed
without warning.
3. Make sure you provide a suitable amount of information to work with. This
means you should provide:
- Guidance on **how to reproduce the issue**. Ideally, this should be a
*small* code sample that can be run immediately by the maintainers.
Failing that, let us know what you're doing, how often it happens, what
environment you're using, etc. Be thorough: it prevents us needing to ask
further questions.
- Tell us **what you expected to happen**. When we run your example code,
what are we expecting to happen? What does "success" look like for your
code?
- Tell us **what actually happens**. It's not helpful for you to say "it
doesn't work" or "it fails". Tell us *how* it fails: do you get an
exception? A hang? A non-200 status code? How was the actual result
different from your expected result?
- Tell us **what version of Requests you're using**, and
**how you installed it**. Different versions of Requests behave
differently and have different bugs, and some distributors of Requests
ship patches on top of the code we supply.
If you do not provide all of these things, it will take us much longer to
fix your problem. If we ask you to clarify these and you never respond, we
will close your issue without fixing it.

File diff suppressed because it is too large Load Diff

22
LICENSE
View File

@@ -1,13 +1,13 @@
Copyright (c) 2011 Kenneth Reitz.
Copyright 2017 Kenneth Reitz
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1 +1,2 @@
include README.rst LICENSE HISTORY.rst
include README.rst LICENSE NOTICE HISTORY.rst pytest.ini requirements.txt
recursive-include tests *.py

27
Makefile Normal file
View File

@@ -0,0 +1,27 @@
.PHONY: docs
init:
pip install -r requirements.txt
test:
# This runs all of the tests, on both Python 2 and Python 3.
detox
ci:
py.test -n 8 --boxed --junitxml=report.xml
test-readme:
@python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo "README.rst and HISTORY.rst ok") || echo "Invalid markup in README.rst or HISTORY.rst!"
flake8:
flake8 --ignore=E501,F401,E128,E402,E731,F821 requests
coverage:
py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests
publish:
pip install 'twine>=1.5.0'
python setup.py sdist bdist_wheel
twine upload dist/*
rm -fr build dist .egg requests.egg-info
docs:
cd docs && make html
@echo "\033[95m\n\nBuild successful! View the docs homepage at docs/_build/html/index.html.\n\033[0m"

12
NOTICE
View File

@@ -1,12 +0,0 @@
Request includes some vendorized python libraries to ease installation.
Poster License
==============
Copyright (c) 2010 Chris AtLee
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,138 +1,114 @@
Requests: The Simple (e.g. usable) HTTP Module
==============================================
Requests: HTTP for Humans
=========================
Most existing Python modules for dealing HTTP requests are insane. I have to look up *everything* that I want to do. Most of my worst Python experiences are a result of the various built-in HTTP libraries (yes, even worse than Logging).
.. image:: https://img.shields.io/pypi/v/requests.svg
:target: https://pypi.python.org/pypi/requests
But this one's different. This one's going to be awesome. And simple.
.. image:: https://img.shields.io/pypi/l/requests.svg
:target: https://pypi.python.org/pypi/requests
Really simple.
.. image:: https://img.shields.io/pypi/pyversions/requests.svg
:target: https://pypi.python.org/pypi/requests
Features
--------
.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master
:target: https://codecov.io/github/requests/requests
:alt: codecov.io
- Extremely simple GET, HEAD, POST, PUT, DELETE Requests
+ Simple HTTP Header Request Attachment
+ Simple Data/Params Request Attachment
+ Simple Multipart File Uploads
+ CookieJar Support
- Simple Basic HTTP Authentication
+ Simple URL + HTTP Auth Registry
.. image:: https://img.shields.io/github/contributors/requests/requests.svg
:target: https://github.com/requests/requests/graphs/contributors
.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
:target: https://saythanks.io/to/kennethreitz
Usage
-----
It couldn't be simpler. ::
Requests is the only *Non-GMO* HTTP library for Python, safe for human
consumption.
>>> import requests
>>> r = requests.get('http://google.com')
**Warning:** Recreational use of the Python standard library for HTTP may result in dangerous side-effects,
including: security vulnerabilities, verbose code, reinventing the wheel,
constantly reading documentation, depression, headaches, or even death.
Behold, the power of Requests:
HTTPS? Basic Authentication? ::
>>> r = requests.get('https://convore.com/api/account/verify.json')
.. code-block:: python
>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
>>> r.status_code
401
Uh oh, we're not authorized! Let's add authentication. ::
>>> conv_auth = requests.AuthObject('requeststest', 'requeststest')
>>> r = requests.get('https://convore.com/api/account/verify.json', auth=conv_auth)
>>> r.status_code
200
200
>>> r.headers['content-type']
'application/json'
>>> r.content
'{"username": "requeststest", "url": "/users/requeststest/", "id": "9408", "img": "censored-long-url"}'
'application/json; charset=utf8'
>>> r.encoding
'utf-8'
>>> r.text
u'{"type":"User"...'
>>> r.json()
{u'disk_usage': 368627, u'private_gists': 484, ...}
See `the similar code, sans Requests <https://gist.github.com/973705>`_.
.. image:: https://raw.githubusercontent.com/requests/requests/master/docs/_static/requests-logo-small.png
:target: http://docs.python-requests.org/
Requests allows you to send *organic, grass-fed* HTTP/1.1 requests, without the
need for manual labor. There's no need to manually add query strings to your
URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling
are 100% automatic, thanks to `urllib3 <https://github.com/shazow/urllib3>`_.
API
---
**Requests:**
Besides, all the cool kids are doing it. Requests is one of the most
downloaded Python packages of all time, pulling in over 11,000,000 downloads
every month. You don't want to be left out!
All request functions return a Response object (see below).
Feature Support
---------------
If a {filename: fileobject} dictionary is passed in (files=...), a multipart_encode upload will be performed.
If CookieJar object is is passed in (cookies=...), the cookies will be sent with the request.
GET Requests
>>> request.get(url, params={}, headers={}, cookies=None, auth=None)
<request object>
HEAD Requests
>>> request.head(url, params={}, headers={}, cookies=None, auth=None)
<request object>
PUT Requests
>>> request.put(url, data='', headers={}, files={}, cookies=None, auth=None)
<request object>
POST Requests
>>> request.post(url, data={}, headers={}, files={}, cookies=None, auth=None)
<request object>
DELETE Requests
>>> request.delete(url, params={}, headers={}, cookies=None, auth=None)
<request object>
**Responses:**
Request.status_code:
(Integer) Received HTTP Status Code Response
Request.headers:
(Dictionary) Received HTTP Response Headers
Request.content:
(Bytes) Received Content
Request.url
(String) URL of response. Useful for detecting redirects.
**HTTP Authentication Registry:**
You can register AuthObjects to automatically enable HTTP Authentication on requests that contain a registered base URL string.
>>> requests.add_autoauth(url, authobject)
Requests is ready for today's web.
- International Domains and URLs
- Keep-Alive & Connection Pooling
- Sessions with Cookie Persistence
- Browser-style SSL Verification
- Basic/Digest Authentication
- Elegant Key/Value Cookies
- Automatic Decompression
- Automatic Content Decoding
- Unicode Response Bodies
- Multipart File Uploads
- HTTP(S) Proxy Support
- Connection Timeouts
- Streaming Downloads
- ``.netrc`` Support
- Chunked Requests
Requests officially supports Python 2.62.7 & 3.33.7, and runs great on PyPy.
Installation
------------
To install requests, simply: ::
To install Requests, simply:
.. code-block:: bash
$ pip install requests
Or, if you absolutely must: ::
✨🍰✨
$ easy_install requests
Satisfaction guaranteed.
But, you really shouldn't do that.
Documentation
-------------
Fantastic documentation is available at http://docs.python-requests.org/, for a limited time only.
Contribute
----------
How to Contribute
-----------------
If you'd like to contribute, simply fork `the repository`_, commit your changes to the **develop** branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS_.
#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a `Contributor Friendly`_ tag for issues that should be ideal for people who are not very familiar with the codebase yet.
#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).
#. Write a test which shows that the bug was fixed or that the feature works as expected.
#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.
Roadmap
-------
- Sphinx Documentation
- Exhaustive Unittests
.. _`the repository`: http://github.com/kennethreitz/requests
.. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORS
.. _`the repository`: http://github.com/requests/requests
.. _AUTHORS: https://github.com/requests/requests/blob/master/AUTHORS.rst
.. _Contributor Friendly: https://github.com/requests/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open

229
_appveyor/install.ps1 Normal file
View File

@@ -0,0 +1,229 @@
# Sample script to install Python and pip under Windows
# Authors: Olivier Grisel, Jonathan Helmus, Kyle Kastner, and Alex Willmer
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
$BASE_URL = "https://www.python.org/ftp/python/"
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
$GET_PIP_PATH = "C:\get-pip.py"
$PYTHON_PRERELEASE_REGEX = @"
(?x)
(?<major>\d+)
\.
(?<minor>\d+)
\.
(?<micro>\d+)
(?<prerelease>[a-z]{1,2}\d+)
"@
function Download ($filename, $url) {
$webclient = New-Object System.Net.WebClient
$basedir = $pwd.Path + "\"
$filepath = $basedir + $filename
if (Test-Path $filename) {
Write-Host "Reusing" $filepath
return $filepath
}
# Download and retry up to 3 times in case of network transient errors.
Write-Host "Downloading" $filename "from" $url
$retry_attempts = 2
for ($i = 0; $i -lt $retry_attempts; $i++) {
try {
$webclient.DownloadFile($url, $filepath)
break
}
Catch [Exception]{
Start-Sleep 1
}
}
if (Test-Path $filepath) {
Write-Host "File saved at" $filepath
} else {
# Retry once to get the error message if any at the last try
$webclient.DownloadFile($url, $filepath)
}
return $filepath
}
function ParsePythonVersion ($python_version) {
if ($python_version -match $PYTHON_PRERELEASE_REGEX) {
return ([int]$matches.major, [int]$matches.minor, [int]$matches.micro,
$matches.prerelease)
}
$version_obj = [version]$python_version
return ($version_obj.major, $version_obj.minor, $version_obj.build, "")
}
function DownloadPython ($python_version, $platform_suffix) {
$major, $minor, $micro, $prerelease = ParsePythonVersion $python_version
if (($major -le 2 -and $micro -eq 0) `
-or ($major -eq 3 -and $minor -le 2 -and $micro -eq 0) `
) {
$dir = "$major.$minor"
$python_version = "$major.$minor$prerelease"
} else {
$dir = "$major.$minor.$micro"
}
if ($prerelease) {
if (($major -le 2) `
-or ($major -eq 3 -and $minor -eq 1) `
-or ($major -eq 3 -and $minor -eq 2) `
-or ($major -eq 3 -and $minor -eq 3) `
) {
$dir = "$dir/prev"
}
}
if (($major -le 2) -or ($major -le 3 -and $minor -le 4)) {
$ext = "msi"
if ($platform_suffix) {
$platform_suffix = ".$platform_suffix"
}
} else {
$ext = "exe"
if ($platform_suffix) {
$platform_suffix = "-$platform_suffix"
}
}
$filename = "python-$python_version$platform_suffix.$ext"
$url = "$BASE_URL$dir/$filename"
$filepath = Download $filename $url
return $filepath
}
function InstallPython ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -eq "32") {
$platform_suffix = ""
} else {
$platform_suffix = "amd64"
}
$installer_path = DownloadPython $python_version $platform_suffix
$installer_ext = [System.IO.Path]::GetExtension($installer_path)
Write-Host "Installing $installer_path to $python_home"
$install_log = $python_home + ".log"
if ($installer_ext -eq '.msi') {
InstallPythonMSI $installer_path $python_home $install_log
} else {
InstallPythonEXE $installer_path $python_home $install_log
}
if (Test-Path $python_home) {
Write-Host "Python $python_version ($architecture) installation complete"
} else {
Write-Host "Failed to install Python in $python_home"
Get-Content -Path $install_log
Exit 1
}
}
function InstallPythonEXE ($exepath, $python_home, $install_log) {
$install_args = "/quiet InstallAllUsers=1 TargetDir=$python_home"
RunCommand $exepath $install_args
}
function InstallPythonMSI ($msipath, $python_home, $install_log) {
$install_args = "/qn /log $install_log /i $msipath TARGETDIR=$python_home"
$uninstall_args = "/qn /x $msipath"
RunCommand "msiexec.exe" $install_args
if (-not(Test-Path $python_home)) {
Write-Host "Python seems to be installed else-where, reinstalling."
RunCommand "msiexec.exe" $uninstall_args
RunCommand "msiexec.exe" $install_args
}
}
function RunCommand ($command, $command_args) {
Write-Host $command $command_args
Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru
}
function InstallPip ($python_home) {
$pip_path = $python_home + "\Scripts\pip.exe"
$python_path = $python_home + "\python.exe"
if (-not(Test-Path $pip_path)) {
Write-Host "Installing pip..."
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
Write-Host "Executing:" $python_path $GET_PIP_PATH
& $python_path $GET_PIP_PATH
} else {
Write-Host "pip already installed."
}
}
function DownloadMiniconda ($python_version, $platform_suffix) {
if ($python_version -eq "3.4") {
$filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"
} else {
$filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"
}
$url = $MINICONDA_URL + $filename
$filepath = Download $filename $url
return $filepath
}
function InstallMiniconda ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -eq "32") {
$platform_suffix = "x86"
} else {
$platform_suffix = "x86_64"
}
$filepath = DownloadMiniconda $python_version $platform_suffix
Write-Host "Installing" $filepath "to" $python_home
$install_log = $python_home + ".log"
$args = "/S /D=$python_home"
Write-Host $filepath $args
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
if (Test-Path $python_home) {
Write-Host "Python $python_version ($architecture) installation complete"
} else {
Write-Host "Failed to install Python in $python_home"
Get-Content -Path $install_log
Exit 1
}
}
function InstallMinicondaPip ($python_home) {
$pip_path = $python_home + "\Scripts\pip.exe"
$conda_path = $python_home + "\Scripts\conda.exe"
if (-not(Test-Path $pip_path)) {
Write-Host "Installing pip..."
$args = "install --yes pip"
Write-Host $conda_path $args
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
} else {
Write-Host "pip already installed."
}
}
function main () {
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
InstallPip $env:PYTHON
}
main

51
appveyor.yml Normal file
View File

@@ -0,0 +1,51 @@
# AppVeyor.yml from https://github.com/ogrisel/python-appveyor-demo
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
build: off
environment:
matrix:
- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
TOXENV: "py27"
- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "64"
TOXENV: "py34"
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"
TOXENV: "py35"
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"
TOXENV: "py36"
install:
# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
- ps: if (-not(Test-Path($env:PYTHON))) { & _appveyor\install.ps1 }
# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"
- "C:\\MinGW\\bin\\mingw32-make"
test_script:
- "C:\\MinGW\\bin\\mingw32-make coverage"
on_success:
- "codecov -f coverage.xml"

View File

@@ -1 +0,0 @@
include HISTORY.rst README.rst LICENSE

View File

@@ -7,6 +7,11 @@ SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
@@ -14,8 +19,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@@ -25,53 +29,66 @@ help:
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
.PHONY: clean
clean:
-rm -rf $(BUILDDIR)/*
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@@ -81,6 +98,16 @@ qthelp:
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Requests.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@@ -90,11 +117,13 @@ devhelp:
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Requests"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@@ -102,22 +131,33 @@ latex:
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@@ -125,29 +165,52 @@ texinfo:
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

39
docs/_static/custom.css vendored Normal file
View File

@@ -0,0 +1,39 @@
#carbonads {
display: block;
overflow: hidden;
padding: 1em;
background-color: #eeeeee;
text-align: center;
border: solid 1px #cccccc;
margin: 1.5em 0 2em;
border-radius: 2px;
line-height: 1.5;
}
#carbonads a {
border-bottom: 0;
}
#carbonads span {
display: block;
overflow: hidden;
}
.carbon-img {
display: block;
margin: 0 auto 1em;
text-align: center;
}
.carbon-text {
display: block;
margin-bottom: 1em;
}
.carbon-poweredby {
display: block;
text-transform: uppercase;
letter-spacing: 1px;
line-height: 1;
font-size: 10px;
}

116
docs/_static/konami.js vendored Normal file
View File

@@ -0,0 +1,116 @@
/*
* Konami-JS ~
* :: Now with support for touch events and multiple instances for
* :: those situations that call for multiple easter eggs!
* Code: http://konami-js.googlecode.com/
* Examples: http://www.snaptortoise.com/konami-js
* Copyright (c) 2009 George Mandis (georgemandis.com, snaptortoise.com)
* Version: 1.4.2 (9/2/2013)
* Licensed under the MIT License (http://opensource.org/licenses/MIT)
* Tested in: Safari 4+, Google Chrome 4+, Firefox 3+, IE7+, Mobile Safari 2.2.1 and Dolphin Browser
*/
var Konami = function (callback) {
var konami = {
addEvent: function (obj, type, fn, ref_obj) {
if (obj.addEventListener)
obj.addEventListener(type, fn, false);
else if (obj.attachEvent) {
// IE
obj["e" + type + fn] = fn;
obj[type + fn] = function () {
obj["e" + type + fn](window.event, ref_obj);
};
obj.attachEvent("on" + type, obj[type + fn]);
}
},
input: "",
pattern: "38384040373937396665",
load: function (link) {
this.addEvent(document, "keydown", function (e, ref_obj) {
if (ref_obj) konami = ref_obj; // IE
konami.input += e ? e.keyCode : event.keyCode;
if (konami.input.length > konami.pattern.length)
konami.input = konami.input.substr((konami.input.length - konami.pattern.length));
if (konami.input == konami.pattern) {
konami.code(link);
konami.input = "";
e.preventDefault();
return false;
}
}, this);
this.iphone.load(link);
},
code: function (link) {
window.location = link
},
iphone: {
start_x: 0,
start_y: 0,
stop_x: 0,
stop_y: 0,
tapTolerance: 8,
capture: false,
orig_keys: "",
keys: ["UP", "UP", "DOWN", "DOWN", "LEFT", "RIGHT", "LEFT", "RIGHT", "TAP", "TAP"],
code: function (link) {
konami.code(link);
},
touchCapture: function(evt) {
konami.iphone.start_x = evt.changedTouches[0].pageX;
konami.iphone.start_y = evt.changedTouches[0].pageY;
konami.iphone.capture = true;
},
load: function (link) {
this.orig_keys = this.keys;
konami.addEvent(document, "touchmove", function (e) {
if (e.touches.length == 1 && konami.iphone.capture == true) {
var touch = e.touches[0];
konami.iphone.stop_x = touch.pageX;
konami.iphone.stop_y = touch.pageY;
konami.iphone.check_direction();
}
});
konami.addEvent(document, "touchend", function (evt) {
konami.touchCapture(evt);
konami.iphone.check_direction(link);
}, false);
konami.addEvent(document, "touchstart", function (evt) {
konami.touchCapture(evt);
});
},
check_direction: function (link) {
var x_magnitude = Math.abs(this.start_x - this.stop_x);
var y_magnitude = Math.abs(this.start_y - this.stop_y);
var hasMoved = (x_magnitude > this.tapTolerance || y_magnitude > this.tapTolerance);
var result;
if (this.capture === true && hasMoved) {
this.capture = false;
var x = ((this.start_x - this.stop_x) < 0) ? "RIGHT" : "LEFT";
var y = ((this.start_y - this.stop_y) < 0) ? "DOWN" : "UP";
var result = (x_magnitude > y_magnitude) ? x : y;
}
else if (this.capture === false && !hasMoved) {
result = (this.tap == true) ? "TAP" : result;
result = "TAP";
}
if (result) {
if (result == this.keys[0]) this.keys = this.keys.slice(1, this.keys.length);
else this.keys = this.orig_keys;
}
if (this.keys.length == 0) {
this.keys = this.orig_keys;
this.code(link);
}
}
}
}
typeof callback === "string" && konami.load(callback);
if (typeof callback === "function") {
konami.code = callback;
konami.load();
}
return konami;
};

BIN
docs/_static/requests-logo-small.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

BIN
docs/_static/requests-sidebar.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

54
docs/_templates/hacks.html vendored Normal file
View File

@@ -0,0 +1,54 @@
<!-- Alabaster (krTheme++) Hacks -->
<!-- CSS Adjustments (I'm very picky.) -->
<style type="text/css">
/* Rezzy requires precise alignment. */
img.logo {margin-left: -20px!important;}
/* "Quick Search" should be capitalized. */
div#searchbox h3 {text-transform: capitalize;}
/* Make the document a little wider, less code is cut-off. */
div.document {width: 1008px;}
/* Much-improved spacing around code blocks. */
div.highlight pre {padding: 11px 14px;}
/* Remain Responsive! */
@media screen and (max-width: 1008px) {
div.sphinxsidebar {display: none;}
div.document {width: 100%!important;}
/* Have code blocks escape the document right-margin. */
div.highlight pre {margin-right: -30px;}
}
</style>
<!-- Analytics tracking for Kenneth. -->
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '56ca7a57c88d9011080024dd');
t.setAttribute('data-track-path', 'https://track.gaug.es/track.gif');
t.src = 'https://d36ee2fcip1434.cloudfront.net/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>
<!-- There are no more hacks. -->
<!-- இڿڰۣ-ڰۣ— -->
<!-- Love, Kenneth Reitz -->
<script src="{{ pathto('_static/', 1) }}/konami.js"></script>
<script>
var easter_egg = new Konami('http://fortunes.herokuapp.com/random/raw');
</script>
<!-- That was not a hack. That was art. -->

71
docs/_templates/sidebarintro.html vendored Normal file
View File

@@ -0,0 +1,71 @@
<p class="logo">
<a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/requests-sidebar.png', 1) }}" title="https://kennethreitz.org/tattoos"/>
</a>
</p>
<p>
<iframe src="http://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>
<p>
Requests is an elegant and simple HTTP library for Python, built for
human beings.
</p>
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg" id="_carbonads_js"></script>
<h3>Stay Informed</h3>
<p>Receive updates on new releases and upcoming projects.</p>
<p><iframe src="http://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"
allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>
<p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
<p><a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>
<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>
<h3>Other Projects</h3>
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
<ul>
<li><a href="http://edmsynths.com/">edmsynths.com</a></li>
<li><a href="http://pipenv.org/">pipenv</a></li>
<li><a href="http://pep8.org/">pep8.org</a></li>
<li><a href="http://httpbin.org/">httpbin.org</a></li>
<li><a href="http://python-guide.org">The Python Guide</a></li>
<li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>
<li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>
<li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>
<li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>
</ul>
<h3>Useful Links</h3>
<ul>
<li><a href="http://docs.python-requests.org/en/latest/community/recommended/">Recommended Packages and Extensions</a></li>
<p></p>
<li><a href="http://github.com/requests/requests">Requests @ GitHub</a></li>
<li><a href="http://pypi.python.org/pypi/requests">Requests @ PyPI</a></li>
<li><a href="http://github.com/requests/requests/issues">Issue Tracker</a></li>
<li><a href="http://docs.python-requests.org/en/latest/community/updates/#software-updates">Release History</a></li>
</ul>
<h3>Translations</h3>
<ul>
<li><a href="http://docs.python-requests.org/">English</a></li>
<li><a href="http://fr.python-requests.org/">French</a></li>
<li><a href="http://de.python-requests.org/">German</a></li>
<li><a href="http://jp.python-requests.org/">Japanese</a></li>
<li><a href="http://cn.python-requests.org/">Chinese</a></li>
<li><a href="http://pt.python-requests.org/">Portuguese</a></li>
<li><a href="http://it.python-requests.org/">Italian</a></li>
<li><a href="http://es.python-requests.org/">Spanish</a></li>
</ul>

62
docs/_templates/sidebarlogo.html vendored Normal file
View File

@@ -0,0 +1,62 @@
<p class="logo">
<a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/requests-sidebar.png', 1) }}" title="https://kennethreitz.org/tattoos"/>
</a>
</p>
<p>
<iframe src="http://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>
<p>
Requests is an elegant and simple HTTP library for Python, built for
human beings. You are currently looking at the documentation of the
development release.
</p>
<h3>Stay Informed</h3>
<p>Receive updates on new releases and upcoming projects.</p>
<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>
<hr/>
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg" id="_carbonads_js"></script>
<p>If you enjoy using this project, <a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>
<p><iframe src="http://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"
allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>
<p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
<h3>Other Projects</h3>
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
<ul>
<li><a href="http://edmsynths.com/">edmsynths.com</a></li>
<li><a href="http://pipenv.org/">pipenv</a></li>
<li><a href="http://pep8.org/">pep8.org</a></li>
<li><a href="http://httpbin.org/">httpbin.org</a></li>
<li><a href="http://python-guide.org">The Python Guide</a></li>
<li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>
<li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>
<li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>
<li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>
</ul>
<h3>Translations</h3>
<ul>
<li><a href="http://docs.python-requests.org/">English</a></li>
<li><a href="http://fr.python-requests.org/">French</a></li>
<li><a href="http://de.python-requests.org/">German</a></li>
<li><a href="http://jp.python-requests.org/">Japanese</a></li>
<li><a href="http://cn.python-requests.org/">Chinese</a></li>
<li><a href="http://pt.python-requests.org/">Portuguese</a></li>
<li><a href="http://it.python-requests.org/">Italian</a></li>
<li><a href="http://es.python-requests.org/">Spanish</a></li>
</ul>

3
docs/_themes/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*.pyc
*.pyo
.DS_Store

45
docs/_themes/LICENSE vendored Normal file
View File

@@ -0,0 +1,45 @@
Modifications:
Copyright (c) 2011 Kenneth Reitz.
Original Project:
Copyright (c) 2010 by Armin Ronacher.
Some rights reserved.
Redistribution and use in source and binary forms of the theme, with or
without modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
We kindly ask you to only use these themes in an unmodified manner just
for Flask and Flask-related products, not for unrelated projects. If you
like the visual style and want to use it for your own projects, please
consider making some larger changes to the themes (such as changing
font faces, sizes, colors or margins).
THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

86
docs/_themes/flask_theme_support.py vendored Normal file
View File

@@ -0,0 +1,86 @@
# flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = ""
styles = {
# No corresponding class for the following:
#Text: "", # class: ''
Whitespace: "underline #f8f8f8", # class: 'w'
Error: "#a40000 border:#ef2929", # class: 'err'
Other: "#000000", # class 'x'
Comment: "italic #8f5902", # class: 'c'
Comment.Preproc: "noitalic", # class: 'cp'
Keyword: "bold #004461", # class: 'k'
Keyword.Constant: "bold #004461", # class: 'kc'
Keyword.Declaration: "bold #004461", # class: 'kd'
Keyword.Namespace: "bold #004461", # class: 'kn'
Keyword.Pseudo: "bold #004461", # class: 'kp'
Keyword.Reserved: "bold #004461", # class: 'kr'
Keyword.Type: "bold #004461", # class: 'kt'
Operator: "#582800", # class: 'o'
Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
# because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables.
Name: "#000000", # class: 'n'
Name.Attribute: "#c4a000", # class: 'na' - to be revised
Name.Builtin: "#004461", # class: 'nb'
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
Name.Class: "#000000", # class: 'nc' - to be revised
Name.Constant: "#000000", # class: 'no' - to be revised
Name.Decorator: "#888", # class: 'nd' - to be revised
Name.Entity: "#ce5c00", # class: 'ni'
Name.Exception: "bold #cc0000", # class: 'ne'
Name.Function: "#000000", # class: 'nf'
Name.Property: "#000000", # class: 'py'
Name.Label: "#f57900", # class: 'nl'
Name.Namespace: "#000000", # class: 'nn' - to be revised
Name.Other: "#000000", # class: 'nx'
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
Name.Variable: "#000000", # class: 'nv' - to be revised
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
Number: "#990000", # class: 'm'
Literal: "#000000", # class: 'l'
Literal.Date: "#000000", # class: 'ld'
String: "#4e9a06", # class: 's'
String.Backtick: "#4e9a06", # class: 'sb'
String.Char: "#4e9a06", # class: 'sc'
String.Doc: "italic #8f5902", # class: 'sd' - like a comment
String.Double: "#4e9a06", # class: 's2'
String.Escape: "#4e9a06", # class: 'se'
String.Heredoc: "#4e9a06", # class: 'sh'
String.Interpol: "#4e9a06", # class: 'si'
String.Other: "#4e9a06", # class: 'sx'
String.Regex: "#4e9a06", # class: 'sr'
String.Single: "#4e9a06", # class: 's1'
String.Symbol: "#4e9a06", # class: 'ss'
Generic: "#000000", # class: 'g'
Generic.Deleted: "#a40000", # class: 'gd'
Generic.Emph: "italic #000000", # class: 'ge'
Generic.Error: "#ef2929", # class: 'gr'
Generic.Heading: "bold #000080", # class: 'gh'
Generic.Inserted: "#00A000", # class: 'gi'
Generic.Output: "#888", # class: 'go'
Generic.Prompt: "#745334", # class: 'gp'
Generic.Strong: "bold #000000", # class: 'gs'
Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Traceback: "bold #a40000", # class: 'gt'
}

270
docs/api.rst Normal file
View File

@@ -0,0 +1,270 @@
.. _api:
Developer Interface
===================
.. module:: requests
This part of the documentation covers all the interfaces of Requests. For
parts where Requests depends on external libraries, we document the most
important right here and provide links to the canonical documentation.
Main Interface
--------------
All of Requests' functionality can be accessed by these 7 methods.
They all return an instance of the :class:`Response <Response>` object.
.. autofunction:: request
.. autofunction:: head
.. autofunction:: get
.. autofunction:: post
.. autofunction:: put
.. autofunction:: patch
.. autofunction:: delete
Exceptions
----------
.. autoexception:: requests.RequestException
.. autoexception:: requests.ConnectionError
.. autoexception:: requests.HTTPError
.. autoexception:: requests.URLRequired
.. autoexception:: requests.TooManyRedirects
.. autoexception:: requests.ConnectTimeout
.. autoexception:: requests.ReadTimeout
.. autoexception:: requests.Timeout
Request Sessions
----------------
.. _sessionapi:
.. autoclass:: Session
:inherited-members:
Lower-Level Classes
-------------------
.. autoclass:: requests.Request
:inherited-members:
.. autoclass:: Response
:inherited-members:
Lower-Lower-Level Classes
-------------------------
.. autoclass:: requests.PreparedRequest
:inherited-members:
.. autoclass:: requests.adapters.BaseAdapter
:inherited-members:
.. autoclass:: requests.adapters.HTTPAdapter
:inherited-members:
Authentication
--------------
.. autoclass:: requests.auth.AuthBase
.. autoclass:: requests.auth.HTTPBasicAuth
.. autoclass:: requests.auth.HTTPProxyAuth
.. autoclass:: requests.auth.HTTPDigestAuth
Encodings
---------
.. autofunction:: requests.utils.get_encodings_from_content
.. autofunction:: requests.utils.get_encoding_from_headers
.. autofunction:: requests.utils.get_unicode_from_response
.. _api-cookies:
Cookies
-------
.. autofunction:: requests.utils.dict_from_cookiejar
.. autofunction:: requests.utils.add_dict_to_cookiejar
.. autofunction:: requests.cookies.cookiejar_from_dict
.. autoclass:: requests.cookies.RequestsCookieJar
:inherited-members:
.. autoclass:: requests.cookies.CookieConflictError
:inherited-members:
Status Code Lookup
------------------
.. autoclass:: requests.codes
::
>>> requests.codes['temporary_redirect']
307
>>> requests.codes.teapot
418
>>> requests.codes['\o/']
200
Migrating to 1.x
----------------
This section details the main differences between 0.x and 1.x and is meant
to ease the pain of upgrading.
API Changes
~~~~~~~~~~~
* ``Response.json`` is now a callable and not a property of a response.
::
import requests
r = requests.get('https://github.com/timeline.json')
r.json() # This *call* raises an exception if JSON decoding fails
* The ``Session`` API has changed. Sessions objects no longer take parameters.
``Session`` is also now capitalized, but it can still be
instantiated with a lowercase ``session`` for backwards compatibility.
::
s = requests.Session() # formerly, session took parameters
s.auth = auth
s.headers.update(headers)
r = s.get('http://httpbin.org/headers')
* All request hooks have been removed except 'response'.
* Authentication helpers have been broken out into separate modules. See
requests-oauthlib_ and requests-kerberos_.
.. _requests-oauthlib: https://github.com/requests/requests-oauthlib
.. _requests-kerberos: https://github.com/requests/requests-kerberos
* The parameter for streaming requests was changed from ``prefetch`` to
``stream`` and the logic was inverted. In addition, ``stream`` is now
required for raw response reading.
::
# in 0.x, passing prefetch=False would accomplish the same thing
r = requests.get('https://github.com/timeline.json', stream=True)
for chunk in r.iter_content(8192):
...
* The ``config`` parameter to the requests method has been removed. Some of
these options are now configured on a ``Session`` such as keep-alive and
maximum number of redirects. The verbosity option should be handled by
configuring logging.
::
import requests
import logging
# Enabling debugging at http.client level (requests->urllib3->http.client)
# you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
# the only thing missing will be the response.body which is not logged.
try: # for Python 3
from http.client import HTTPConnection
except ImportError:
from httplib import HTTPConnection
HTTPConnection.debuglevel = 1
logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
requests.get('http://httpbin.org/headers')
Licensing
~~~~~~~~~
One key difference that has nothing to do with the API is a change in the
license from the ISC_ license to the `Apache 2.0`_ license. The Apache 2.0
license ensures that contributions to Requests are also covered by the Apache
2.0 license.
.. _ISC: http://opensource.org/licenses/ISC
.. _Apache 2.0: http://opensource.org/licenses/Apache-2.0
Migrating to 2.x
----------------
Compared with the 1.0 release, there were relatively few backwards
incompatible changes, but there are still a few issues to be aware of with
this major release.
For more details on the changes in this release including new APIs, links
to the relevant GitHub issues and some of the bug fixes, read Cory's blog_
on the subject.
.. _blog: http://lukasa.co.uk/2013/09/Requests_20/
API Changes
~~~~~~~~~~~
* There were a couple changes to how Requests handles exceptions.
``RequestException`` is now a subclass of ``IOError`` rather than
``RuntimeError`` as that more accurately categorizes the type of error.
In addition, an invalid URL escape sequence now raises a subclass of
``RequestException`` rather than a ``ValueError``.
::
requests.get('http://%zz/') # raises requests.exceptions.InvalidURL
Lastly, ``httplib.IncompleteRead`` exceptions caused by incorrect chunked
encoding will now raise a Requests ``ChunkedEncodingError`` instead.
* The proxy API has changed slightly. The scheme for a proxy URL is now
required.
::
proxies = {
"http": "10.10.1.10:3128", # use http://10.10.1.10:3128 instead
}
# In requests 1.x, this was legal, in requests 2.x,
# this raises requests.exceptions.MissingSchema
requests.get("http://example.org", proxies=proxies)
Behavioural Changes
~~~~~~~~~~~~~~~~~~~~~~~
* Keys in the ``headers`` dictionary are now native strings on all Python
versions, i.e. bytestrings on Python 2 and unicode on Python 3. If the
keys are not native strings (unicode on Python 2 or bytestrings on Python 3)
they will be converted to the native string type assuming UTF-8 encoding.
* Values in the ``headers`` dictionary should always be strings. This has
been the project's position since before 1.0 but a recent change
(since version 2.11.0) enforces this more strictly. It's advised to avoid
passing header values as unicode when possible.

86
docs/community/faq.rst Normal file
View File

@@ -0,0 +1,86 @@
.. _faq:
Frequently Asked Questions
==========================
This part of the documentation answers common questions about Requests.
Encoded Data?
-------------
Requests automatically decompresses gzip-encoded responses, and does
its best to decode response content to unicode when possible.
You can get direct access to the raw response (and even the socket),
if needed as well.
Custom User-Agents?
-------------------
Requests allows you to easily override User-Agent strings, along with
any other HTTP Header.
Why not Httplib2?
-----------------
Chris Adams gave an excellent summary on
`Hacker News <http://news.ycombinator.com/item?id=2884406>`_:
httplib2 is part of why you should use requests: it's far more respectable
as a client but not as well documented and it still takes way too much code
for basic operations. I appreciate what httplib2 is trying to do, that
there's a ton of hard low-level annoyances in building a modern HTTP
client, but really, just use requests instead. Kenneth Reitz is very
motivated and he gets the degree to which simple things should be simple
whereas httplib2 feels more like an academic exercise than something
people should use to build production systems[1].
Disclosure: I'm listed in the requests AUTHORS file but can claim credit
for, oh, about 0.0001% of the awesomeness.
1. http://code.google.com/p/httplib2/issues/detail?id=96 is a good example:
an annoying bug which affect many people, there was a fix available for
months, which worked great when I applied it in a fork and pounded a couple
TB of data through it, but it took over a year to make it into trunk and
even longer to make it onto PyPI where any other project which required "
httplib2" would get the working version.
Python 3 Support?
-----------------
Yes! Here's a list of Python platforms that are officially
supported:
* Python 2.6
* Python 2.7
* Python 3.4
* Python 3.5
* Python 3.6
* PyPy
What are "hostname doesn't match" errors?
-----------------------------------------
These errors occur when :ref:`SSL certificate verification <verification>`
fails to match the certificate the server responds with to the hostname
Requests thinks it's contacting. If you're certain the server's SSL setup is
correct (for example, because you can visit the site with your browser) and
you're using Python 2.6 or 2.7, a possible explanation is that you need
Server-Name-Indication.
`Server-Name-Indication`_, or SNI, is an official extension to SSL where the
client tells the server what hostname it is contacting. This is important
when servers are using `Virtual Hosting`_. When such servers are hosting
more than one SSL site they need to be able to return the appropriate
certificate based on the hostname the client is connecting to.
Python3 and Python 2.7.9+ include native support for SNI in their SSL modules.
For information on using SNI with Requests on Python < 2.7.9 refer to this
`Stack Overflow answer`_.
.. _`Server-Name-Indication`: https://en.wikipedia.org/wiki/Server_Name_Indication
.. _`virtual hosting`: https://en.wikipedia.org/wiki/Virtual_hosting
.. _`Stack Overflow answer`: https://stackoverflow.com/questions/18578439/using-requests-with-tls-doesnt-give-sni-support/18579484#18579484

View File

@@ -0,0 +1,22 @@
Integrations
============
Python for iOS
--------------
Requests is built into the wonderful `Python for iOS <https://itunes.apple.com/us/app/python-2.7-for-ios/id485729872?mt=Python8>`_ runtime!
To give it a try, simply::
import requests
Articles & Talks
================
- `Python for the Web <http://gun.io/blog/python-for-the-web/>`_ teaches how to use Python to interact with the web, using Requests.
- `Daniel Greenfeld's Review of Requests <http://pydanny.blogspot.com/2011/05/python-http-requests-for-humans.html>`_
- `My 'Python for Humans' talk <http://python-for-humans.heroku.com>`_ ( `audio <http://codeconf.s3.amazonaws.com/2011/pycodeconf/talks/PyCodeConf2011%20-%20Kenneth%20Reitz.m4a>`_ )
- `Issac Kelly's 'Consuming Web APIs' talk <http://issackelly.github.com/Consuming-Web-APIs-with-Python-Talk/slides/slides.html>`_
- `Blog post about Requests via Yum <http://arunsag.wordpress.com/2011/08/17/new-package-python-requests-http-for-humans/>`_
- `Russian blog post introducing Requests <http://habrahabr.ru/blogs/python/126262/>`_
- `Sending JSON in Requests <http://www.coglib.com/~icordasc/blog/2014/11/sending-json-in-requests.html>`_

View File

@@ -0,0 +1,57 @@
.. _recommended:
Recommended Packages and Extensions
===================================
Requests has a great variety of powerful and useful third-party extensions.
This page provides an overview of some of the best of them.
Certifi CA Bundle
-----------------
`Certifi`_ is a carefully curated collection of Root Certificates for
validating the trustworthiness of SSL certificates while verifying the
identity of TLS hosts. It has been extracted from the Requests project.
.. _Certifi: http://certifi.io/en/latest/
CacheControl
------------
`CacheControl`_ is an extension that adds a full HTTP cache to Requests. This
makes your web requests substantially more efficient, and should be used
whenever you're making a lot of web requests.
.. _CacheControl: https://cachecontrol.readthedocs.io/en/latest/
Requests-Toolbelt
-----------------
`Requests-Toolbelt`_ is a collection of utilities that some users of Requests may desire,
but do not belong in Requests proper. This library is actively maintained
by members of the Requests core team, and reflects the functionality most
requested by users within the community.
.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/en/latest/index.html
Requests-OAuthlib
-----------------
`requests-oauthlib`_ makes it possible to do the OAuth dance from Requests
automatically. This is useful for the large number of websites that use OAuth
to provide authentication. It also provides a lot of tweaks that handle ways
that specific OAuth providers differ from the standard specifications.
.. _requests-oauthlib: https://requests-oauthlib.readthedocs.io/en/latest/
Betamax
-------
`Betamax`_ records your HTTP interactions so the NSA does not have to.
A VCR imitation designed only for Python-Requests.
.. _betamax: https://github.com/sigmavirus24/betamax

View File

@@ -0,0 +1,54 @@
Release Process and Rules
=========================
.. versionadded:: v2.6.2
Starting with the version to be released after ``v2.6.2``, the following rules
will govern and describe how the Requests core team produces a new release.
Major Releases
--------------
A major release will include breaking changes. When it is versioned, it will
be versioned as ``vX.0.0``. For example, if the previous release was
``v10.2.7`` the next version will be ``v11.0.0``.
Breaking changes are changes that break backwards compatibility with prior
versions. If the project were to change the ``text`` attribute on a
``Response`` object to a method, that would only happen in a Major release.
Major releases may also include miscellaneous bug fixes and upgrades to
vendored packages. The core developers of Requests are committed to providing
a good user experience. This means we're also committed to preserving
backwards compatibility as much as possible. Major releases will be infrequent
and will need strong justifications before they are considered.
Minor Releases
--------------
A minor release will not include breaking changes but may include
miscellaneous bug fixes and upgrades to vendored packages. If the previous
version of Requests released was ``v10.2.7`` a minor release would be
versioned as ``v10.3.0``.
Minor releases will be backwards compatible with releases that have the same
major version number. In other words, all versions that would start with
``v10.`` should be compatible with each other.
Hotfix Releases
---------------
A hotfix release will only include bug fixes that were missed when the project
released the previous version. If the previous version of Requests released
``v10.2.7`` the hotfix release would be versioned as ``v10.2.8``.
Hotfixes will **not** include upgrades to vendored dependencies after
``v2.6.2``
Reasoning
---------
In the 2.5 and 2.6 release series, the Requests core team upgraded vendored
dependencies and caused a great deal of headaches for both users and the core
team. To reduce this pain, we're forming a concrete set of procedures so
expectations will be properly set.

View File

@@ -0,0 +1,51 @@
.. _support:
Support
=======
If you have questions or issues about Requests, there are several options:
StackOverflow
-------------
If your question does not contain sensitive (possibly proprietary)
information or can be properly anonymized, please ask a question on
`StackOverflow <https://stackoverflow.com/questions/tagged/python-requests>`_
and use the tag ``python-requests``.
Send a Tweet
------------
If your question is less than 140 characters, feel free to send a tweet to
`@kennethreitz <https://twitter.com/kennethreitz>`_,
`@sigmavirus24 <https://twitter.com/sigmavirus24>`_, or
`@lukasaoz <https://twitter.com/lukasaoz>`_.
File an Issue
-------------
If you notice some unexpected behaviour in Requests, or want to see support
for a new feature,
`file an issue on GitHub <https://github.com/requests/requests/issues>`_.
E-mail
------
I'm more than happy to answer any personal or in-depth questions about
Requests. Feel free to email
`requests@kennethreitz.com <mailto:requests@kennethreitz.com>`_.
IRC
---
The official Freenode channel for Requests is
`#python-requests <irc://irc.freenode.net/python-requests>`_
The core developers of requests are on IRC throughout the day.
You can find them in ``#python-requests`` as:
- kennethreitz
- lukasa
- sigmavirus24

View File

@@ -0,0 +1,30 @@
.. _updates:
Community Updates
=================
If you'd like to stay up to date on the community and development of Requests,
there are several options:
GitHub
------
The best way to track the development of Requests is through
`the GitHub repo <https://github.com/requests/requests>`_.
Twitter
-------
The author, Kenneth Reitz, often tweets about new features and releases of Requests.
Follow `@kennethreitz <https://twitter.com/kennethreitz>`_ for updates.
Release and Version History
===========================
.. include:: ../../HISTORY.rst

View File

@@ -0,0 +1,105 @@
Vulnerability Disclosure
========================
If you think you have found a potential security vulnerability in requests,
please email `sigmavirus24 <mailto:graffatcolmingov@gmail.com>`_ and
`Lukasa <mailto:cory@lukasa.co.uk>`_ directly. **Do not file a public issue.**
Our PGP Key fingerprints are:
- 0161 BB7E B208 B5E0 4FDC 9F81 D9DA 0A04 9113 F853 (@sigmavirus24)
- 90DC AE40 FEA7 4B14 9B70 662D F25F 2144 EEC1 373D (@lukasa)
If English is not your first language, please try to describe the problem and
its impact to the best of your ability. For greater detail, please use your
native language and we will try our best to translate it using online services.
Please also include the code you used to find the problem and the shortest
amount of code necessary to reproduce it.
Please do not disclose this to anyone else. We will retrieve a CVE identifier
if necessary and give you full credit under whatever name or alias you provide.
We will only request an identifier when we have a fix and can publish it in a
release.
We will respect your privacy and will only publicize your involvement if you
grant us permission.
Process
-------
This following information discusses the process the requests project follows
in response to vulnerability disclosures. If you are disclosing a
vulnerability, this section of the documentation lets you know how we will
respond to your disclosure.
Timeline
~~~~~~~~
When you report an issue, one of the project members will respond to you within
two days *at the outside*. In most cases responses will be faster, usually
within 12 hours. This initial response will at the very least confirm receipt
of the report.
If we were able to rapidly reproduce the issue, the initial response will also
contain confirmation of the issue. If we are not, we will often ask for more
information about the reproduction scenario.
Our goal is to have a fix for any vulnerability released within two weeks of
the initial disclosure. This may potentially involve shipping an interim
release that simply disables function while a more mature fix can be prepared,
but will in the vast majority of cases mean shipping a complete release as soon
as possible.
Throughout the fix process we will keep you up to speed with how the fix is
progressing. Once the fix is prepared, we will notify you that we believe we
have a fix. Often we will ask you to confirm the fix resolves the problem in
your environment, especially if we are not confident of our reproduction
scenario.
At this point, we will prepare for the release. We will obtain a CVE number
if one is required, providing you with full credit for the discovery. We will
also decide on a planned release date, and let you know when it is. This
release date will *always* be on a weekday.
At this point we will reach out to our major downstream packagers to notify
them of an impending security-related patch so they can make arrangements. In
addition, these packagers will be provided with the intended patch ahead of
time, to ensure that they are able to promptly release their downstream
packages. Currently the list of people we actively contact *ahead of a public
release* is:
- Jeremy Cline, Red Hat (@jeremycline)
- Daniele Tricoli, Debian (@eriol)
We will notify these individuals at least a week ahead of our planned release
date to ensure that they have sufficient time to prepare. If you believe you
should be on this list, please let one of the maintainers know at one of the
email addresses at the top of this article.
On release day, we will push the patch to our public repository, along with an
updated changelog that describes the issue and credits you. We will then issue
a PyPI release containing the patch.
At this point, we will publicise the release. This will involve mails to
mailing lists, Tweets, and all other communication mechanisms available to the
core team.
We will also explicitly mention which commits contain the fix to make it easier
for other distributors and users to easily patch their own versions of requests
if upgrading is not an option.
Previous CVEs
-------------
- Fixed in 2.6.0
- `CVE 2015-2296 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2015-2296>`_,
reported by Matthew Daley of `BugFuzz <https://bugfuzz.com/>`_.
- Fixed in 2.3.0
- `CVE 2014-1829 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1829>`_
- `CVE 2014-1830 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1830>`_

View File

@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
#
# Requests documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 13 23:54:25 2011.
# sphinx-quickstart on Fri Feb 19 00:05:47 2016.
#
# This file is execfile()d with the current directory set to its containing dir.
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
@@ -11,26 +12,42 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# Insert Requests' path into the system.
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('_themes'))
import requests
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.jsmath', 'sphinx.ext.viewcode']
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
@@ -41,20 +58,24 @@ master_doc = 'index'
# General information about the project.
project = u'Requests'
copyright = u'2011, Kenneth Reitz'
copyright = u'MMXVII. A <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> Project'
author = u'Kenneth Reitz'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.2.0'
version = requests.__version__
# The full version, including alpha/beta/rc tags.
release = '0.2.0'
release = requests.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
@@ -66,37 +87,50 @@ release = '0.2.0'
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
add_function_parentheses = False
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'flask_theme_support.FlaskyStyle'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# -- Options for HTML output ---------------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
html_theme_options = {
'show_powered_by': False,
'github_user': 'requests',
'github_repo': 'requests',
'github_banner': True,
'show_related': False
}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
@@ -122,16 +156,26 @@ html_theme = 'default'
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
html_use_smartypants = False
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
html_sidebars = {
'index': ['sidebarintro.html', 'sourcelink.html', 'searchbox.html',
'hacks.html'],
'**': ['sidebarlogo.html', 'localtoc.html', 'relations.html',
'sourcelink.html', 'searchbox.html', 'hacks.html']
}
# Additional templates that should be rendered to pages, maps page names to
# template names.
@@ -147,13 +191,13 @@ html_static_path = ['_static']
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
@@ -163,23 +207,45 @@ html_static_path = ['_static']
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'Requestsdoc'
# -- Options for LaTeX output ---------------------------------------------
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'Requests.tex', u'Requests Documentation',
u'Kenneth Reitz', 'manual'),
(master_doc, 'Requests.tex', u'Requests Documentation',
u'Kenneth Reitz', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -196,9 +262,6 @@ latex_documents = [
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
@@ -206,27 +269,110 @@ latex_documents = [
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'requests', u'Requests Documentation',
[u'Kenneth Reitz'], 1)
(master_doc, 'requests', u'Requests Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Requests', u'Requests Documentation', u'Kenneth Reitz',
'Requests', 'One line description of project.', 'Miscellaneous'),
(master_doc, 'Requests', u'Requests Documentation',
author, 'Requests', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
texinfo_appendices = []
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# -- Options for Epub output ----------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
# The basename for the epub file. It defaults to the project name.
#epub_basename = project
# The HTML theme for the epub output. Since the default themes are not
# optimized for small screen space, using the same theme for HTML and epub
# output is usually not wise. This defaults to 'epub', a theme designed to save
# visual space.
#epub_theme = 'epub'
# The language of the text. It defaults to the language option
# or 'en' if the language is not set.
#epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
#epub_guide = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# HTML files that should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True
# Choose between 'default' and 'includehidden'.
#epub_tocscope = 'default'
# Fix unsupported image types using the Pillow.
#epub_fix_images = False
# Scale large images.
#epub_max_image_width = 0
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#epub_show_urls = 'inline'
# If false, no index is generated.
#epub_use_index = True
intersphinx_mapping = {'urllib3': ('http://urllib3.readthedocs.io/en/latest', None)}

5
docs/dev/authors.rst Normal file
View File

@@ -0,0 +1,5 @@
Authors
=======
.. include:: ../../AUTHORS.rst

206
docs/dev/contributing.rst Normal file
View File

@@ -0,0 +1,206 @@
.. _contributing:
Contributor's Guide
===================
If you're reading this, you're probably interested in contributing to Requests.
Thank you very much! Open source projects live-and-die based on the support
they receive from others, and the fact that you're even considering
contributing to the Requests project is *very* generous of you.
This document lays out guidelines and advice for contributing to this project.
If you're thinking of contributing, please start by reading this document and
getting a feel for how contributing to this project works. If you have any
questions, feel free to reach out to either `Ian Cordasco`_ or `Cory Benfield`_,
the primary maintainers.
.. _Ian Cordasco: http://www.coglib.com/~icordasc/
.. _Cory Benfield: https://lukasa.co.uk/about
If you have non-technical feedback, philosophical ponderings, crazy ideas, or
other general thoughts about Requests or its position within the Python
ecosystem, the BDFL, `Kenneth Reitz`_, would love to hear from you.
The guide is split into sections based on the type of contribution you're
thinking of making, with a section that covers general guidelines for all
contributors.
.. _Kenneth Reitz: mailto:me@kennethreitz.org
Be Cordial
----------
**Be cordial or be on your way**. *—Kenneth Reitz*
Requests has one very important rule governing all forms of contribution,
including reporting bugs or requesting features. This golden rule is
"`be cordial or be on your way`_".
**All contributions are welcome**, as long as
everyone involved is treated with respect.
.. _be cordial or be on your way: http://kennethreitz.org/be-cordial-or-be-on-your-way/
.. _early-feedback:
Get Early Feedback
------------------
If you are contributing, do not feel the need to sit on your contribution until
it is perfectly polished and complete. It helps everyone involved for you to
seek feedback as early as you possibly can. Submitting an early, unfinished
version of your contribution for feedback in no way prejudices your chances of
getting that contribution accepted, and can save you from putting a lot of work
into a contribution that is not suitable for the project.
Contribution Suitability
------------------------
Our project maintainers have the last word on whether or not a contribution is
suitable for Requests. All contributions will be considered carefully, but from
time to time, contributions will be rejected because they do not suit the
current goals or needs of the project.
If your contribution is rejected, don't despair! As long as you followed these
guidelines, you will have a much better chance of getting your next
contribution accepted.
Code Contributions
------------------
Steps for Submitting Code
~~~~~~~~~~~~~~~~~~~~~~~~~
When contributing code, you'll want to follow this checklist:
1. Fork the repository on GitHub.
2. Run the tests to confirm they all pass on your system. If they don't, you'll
need to investigate why they fail. If you're unable to diagnose this
yourself, raise it as a bug report by following the guidelines in this
document: :ref:`bug-reports`.
3. Write tests that demonstrate your bug or feature. Ensure that they fail.
4. Make your change.
5. Run the entire test suite again, confirming that all tests pass *including
the ones you just added*.
6. Send a GitHub Pull Request to the main repository's ``master`` branch.
GitHub Pull Requests are the expected method of code collaboration on this
project.
The following sub-sections go into more detail on some of the points above.
Code Review
~~~~~~~~~~~
Contributions will not be merged until they've been code reviewed. You should
implement any code review feedback unless you strongly object to it. In the
event that you object to the code review feedback, you should make your case
clearly and calmly. If, after doing so, the feedback is judged to still apply,
you must either apply the feedback or withdraw your contribution.
New Contributors
~~~~~~~~~~~~~~~~
If you are new or relatively new to Open Source, welcome! Requests aims to
be a gentle introduction to the world of Open Source. If you're concerned about
how best to contribute, please consider mailing a maintainer (listed above) and
asking for help.
Please also check the :ref:`early-feedback` section.
Kenneth Reitz's Code Style™
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Requests codebase uses the `PEP 8`_ code style.
In addition to the standards outlined in PEP 8, we have a few guidelines:
- Line-length can exceed 79 characters, to 100, when convenient.
- Line-length can exceed 100 characters, when doing otherwise would be *terribly* inconvenient.
- Always use single-quoted strings (e.g. ``'#flatearth'``), unless a single-quote occurs within the string.
Additionally, one of the styles that PEP8 recommends for `line continuations`_
completely lacks all sense of taste, and is not to be permitted within
the Requests codebase::
# Aligned with opening delimiter.
foo = long_function_name(var_one, var_two,
var_three, var_four)
No. Just don't. Please.
Docstrings are to follow the following syntaxes::
def the_earth_is_flat():
"""NASA divided up the seas into thirty-three degrees."""
pass
::
def fibonacci_spiral_tool():
"""With my feet upon the ground I lose myself / between the sounds
and open wide to suck it in. / I feel it move across my skin. / I'm
reaching up and reaching out. / I'm reaching for the random or
whatever will bewilder me. / Whatever will bewilder me. / And
following our will and wind we may just go where no one's been. /
We'll ride the spiral to the end and may just go where no one's
been.
Spiral out. Keep going...
"""
pass
All functions, methods, and classes are to contain docstrings. Object data
model methods (e.g. ``__repr__``) are typically the exception to this rule.
Thanks for helping to make the world a better place!
.. _PEP 8: http://pep8.org
.. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation
Documentation Contributions
---------------------------
Documentation improvements are always welcome! The documentation files live in
the ``docs/`` directory of the codebase. They're written in
`reStructuredText`_, and use `Sphinx`_ to generate the full suite of
documentation.
When contributing documentation, please do your best to follow the style of the
documentation files. This means a soft-limit of 79 characters wide in your text
files and a semi-formal, yet friendly and approachable, prose style.
When presenting Python code, use single-quoted strings (``'hello'`` instead of
``"hello"``).
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
.. _Sphinx: http://sphinx-doc.org/index.html
.. _bug-reports:
Bug Reports
-----------
Bug reports are hugely important! Before you raise one, though, please check
through the `GitHub issues`_, **both open and closed**, to confirm that the bug
hasn't been reported before. Duplicate bug reports are a huge drain on the time
of other contributors, and should be avoided as much as possible.
.. _GitHub issues: https://github.com/requests/requests/issues
Feature Requests
----------------
Requests is in a perpetual feature freeze, only the BDFL can add or approve of
new features. The maintainers believe that Requests is a feature-complete
piece of software at this time.
One of the most important skills to have while maintaining a largely-used
open source project is learning the ability to say "no" to suggested changes,
while keeping an open ear and mind.
If you believe there is a feature missing, feel free to raise a feature
request, but please do be aware that the overwhelming likelihood is that your
feature request will not be accepted.

41
docs/dev/philosophy.rst Normal file
View File

@@ -0,0 +1,41 @@
Development Philosophy
======================
Requests is an open but opinionated library, created by an open but opinionated developer.
Management Style
~~~~~~~~~~~~~~~~
`Kenneth Reitz <http://kennethreitz.org>`_ is the BDFL. He has final say in any decision related to the Requests project. Kenneth is responsible for the direction and form of the library, as well as its presentation. In addition to making decisions based on technical merit, he is responsible for making decisions based on the development philosophy of Requests.
`Ian Cordasco <http://www.coglib.com/~icordasc/>`_ and `Cory Benfield <https://lukasa.co.uk/about/>`_ are the core contributors. They are responsible for triaging bug reports, reviewing pull requests and ensuring that Kenneth is kept up to speed with developments around the library. The day-to-day managing of the project is done by the core contributors. They are responsible for making judgements about whether or not a feature request is likely to be accepted by Kenneth. Their word is, in some ways, more final than Kenneth's.
Values
~~~~~~
- Simplicity is always better than functionality.
- Listen to everyone, then disregard it.
- The API is all that matters. Everything else is secondary.
- Fit the 90% use-case. Ignore the nay-sayers.
Semantic Versioning
~~~~~~~~~~~~~~~~~~~
For many years, the open source community has been plagued with version number dystonia. Numbers vary so greatly from project to project, they are practically meaningless.
Requests uses `Semantic Versioning <http://semver.org>`_. This specification seeks to put an end to this madness with a small set of practical guidelines for you and your colleagues to use in your next project.
Standard Library?
~~~~~~~~~~~~~~~~~
Requests has no *active* plans to be included in the standard library. This decision has been discussed at length with Guido as well as numerous core developers.
Essentially, the standard library is where a library goes to die. It is appropriate for a module to be included when active development is no longer necessary.
Linux Distro Packages
~~~~~~~~~~~~~~~~~~~~~
Distributions have been made for many Linux repositories, including: Ubuntu, Debian, RHEL, and Arch.
These distributions are sometimes divergent forks, or are otherwise not kept up-to-date with the latest code and bugfixes. PyPI (and its mirrors) and GitHub are the official distribution sources; alternatives are not supported by the Requests project.

63
docs/dev/todo.rst Normal file
View File

@@ -0,0 +1,63 @@
How to Help
===========
Requests is under active development, and contributions are more than welcome!
#. Check for open issues or open a fresh issue to start a discussion around a bug.
There is a Contributor Friendly tag for issues that should be ideal for people who are not very
familiar with the codebase yet.
#. Fork `the repository <https://github.com/requests/requests>`_ on GitHub and start making your
changes to a new branch.
#. Write a test which shows that the bug was fixed.
#. Send a pull request and bug the maintainer until it gets merged and published. :)
Make sure to add yourself to `AUTHORS <https://github.com/requests/requests/blob/master/AUTHORS.rst>`_.
Feature Freeze
--------------
As of v1.0.0, Requests has now entered a feature freeze. Requests for new
features and Pull Requests implementing those features will not be accepted.
Development Dependencies
------------------------
You'll need to install py.test in order to run the Requests' test suite::
$ venv .venv
$ source .venv/bin/activate
$ make
$ python setup.py test
============================= test session starts ==============================
platform darwin -- Python 3.4.4, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
...
collected 445 items
tests/test_hooks.py ...
tests/test_lowlevel.py ............
tests/test_requests.py ...........................................................
tests/test_structures.py ....................
tests/test_testserver.py ...........
tests/test_utils.py ..s...........................................................
============== 442 passed, 1 skipped, 2 xpassed in 46.48 seconds ===============
You can also run ``$ make tests`` to run against all supported Python versions, using tox/detox.
Runtime Environments
--------------------
Requests currently supports the following versions of Python:
- Python 2.6
- Python 2.7
- Python 3.4
- Python 3.5
- Python 3.6
- PyPy
Google AppEngine is not officially supported although support is available
with the `Requests-Toolbelt`_.
.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/

View File

@@ -3,18 +3,170 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Requests's documentation!
====================================
Requests: HTTP for Humans
=========================
Contents:
Release v\ |version|. (:ref:`Installation <install>`)
.. image:: https://img.shields.io/pypi/l/requests.svg
:target: https://pypi.python.org/pypi/requests
.. image:: https://img.shields.io/pypi/wheel/requests.svg
:target: https://pypi.python.org/pypi/requests
.. image:: https://img.shields.io/pypi/pyversions/requests.svg
:target: https://pypi.python.org/pypi/requests
.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master
:target: https://codecov.io/github/requests/requests
:alt: codecov.io
.. image:: https://img.shields.io/badge/Say%20Thanks!-🦉-1EAEDB.svg
:target: https://saythanks.io/to/kennethreitz
**Requests** is the only *Non-GMO* HTTP library for Python, safe for human
consumption.
*Warning: Recreational use of the Python standard library for HTTP may result in dangerous side-effects,
including: security vulnerabilities, verbose code, reinventing the wheel,
constantly reading documentation, depression, headaches, or even death.*
-------------------
**Behold, the power of Requests**::
>>> import requests
>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
>>> r.status_code
200
>>> r.headers['content-type']
'application/json; charset=utf8'
>>> r.encoding
'utf-8'
>>> r.text
u'{"type":"User"...'
>>> r.json()
{u'private_gists': 419, u'total_private_repos': 77, ...}
See `similar code, sans Requests <https://gist.github.com/973705>`_.
**Requests** allows you to send *organic, grass-fed* HTTP/1.1 requests, without the
need for manual labor. There's no need to manually add query strings to your
URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling
are 100% automatic, thanks to `urllib3 <https://github.com/shazow/urllib3>`_.
User Testimonials
-----------------
Twitter, Spotify, Microsoft, Amazon, Lyft, BuzzFeed, Reddit, The NSA, Her Majesty's Government, Google, Twilio, Runscope, Mozilla, Heroku,
PayPal, NPR, Obama for America, Transifex, Native Instruments, The Washington
Post, SoundCloud, Kippt, Sony, and Federal U.S.
Institutions that prefer to be unnamed claim to use Requests internally.
**Armin Ronacher**
*Requests is the perfect example how beautiful an API can be with the
right level of abstraction.*
**Matt DeBoard**
*I'm going to get Kenneth Reitz's Python requests module tattooed
on my body, somehow. The whole thing.*
**Daniel Greenfeld**
*Nuked a 1200 LOC spaghetti code library with 10 lines of code thanks to
Kenneth Reitz's request library. Today has been AWESOME.*
**Kenny Meyers**
*Python HTTP: When in doubt, or when not in doubt, use Requests. Beautiful,
simple, Pythonic.*
Requests is one of the most downloaded Python packages of all time, pulling in
over 11,000,000 downloads every month. All the cool kids are doing it!
Beloved Features
----------------
Requests is ready for today's web.
- Keep-Alive & Connection Pooling
- International Domains and URLs
- Sessions with Cookie Persistence
- Browser-style SSL Verification
- Automatic Content Decoding
- Basic/Digest Authentication
- Elegant Key/Value Cookies
- Automatic Decompression
- Unicode Response Bodies
- HTTP(S) Proxy Support
- Multipart File Uploads
- Streaming Downloads
- Connection Timeouts
- Chunked Requests
- ``.netrc`` Support
Requests officially supports Python 2.62.7 & 3.43.7, and runs great on PyPy.
The User Guide
--------------
This part of the documentation, which is mostly prose, begins with some
background information about Requests, then focuses on step-by-step
instructions for getting the most out of Requests.
.. toctree::
:maxdepth: 2
Indices and tables
==================
user/intro
user/install
user/quickstart
user/advanced
user/authentication
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
The Community Guide
-------------------
This part of the documentation, which is mostly prose, details the
Requests ecosystem and community.
.. toctree::
:maxdepth: 1
community/faq
community/recommended
community/out-there
community/support
community/vulnerabilities
community/updates
community/release-process
The API Documentation / Guide
-----------------------------
If you are looking for information on a specific function, class, or method,
this part of the documentation is for you.
.. toctree::
:maxdepth: 2
api
The Contributor Guide
---------------------
If you want to contribute to the project, this part of the documentation is for
you.
.. toctree::
:maxdepth: 3
dev/contributing
dev/philosophy
dev/todo
dev/authors
There are no more guides. You are now guideless.
Good luck.

View File

@@ -1,190 +1,263 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Requests.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Requests.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 1>NUL 2>NUL
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Requests.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Requests.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end

990
docs/user/advanced.rst Normal file
View File

@@ -0,0 +1,990 @@
.. _advanced:
Advanced Usage
==============
This document covers some of Requests more advanced features.
.. _session-objects:
Session Objects
---------------
The Session object allows you to persist certain parameters across
requests. It also persists cookies across all requests made from the
Session instance, and will use ``urllib3``'s `connection pooling`_. So if
you're making several requests to the same host, the underlying TCP
connection will be reused, which can result in a significant performance
increase (see `HTTP persistent connection`_).
A Session object has all the methods of the main Requests API.
Let's persist some cookies across requests::
s = requests.Session()
s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')
r = s.get('http://httpbin.org/cookies')
print(r.text)
# '{"cookies": {"sessioncookie": "123456789"}}'
Sessions can also be used to provide default data to the request methods. This
is done by providing data to the properties on a Session object::
s = requests.Session()
s.auth = ('user', 'pass')
s.headers.update({'x-test': 'true'})
# both 'x-test' and 'x-test2' are sent
s.get('http://httpbin.org/headers', headers={'x-test2': 'true'})
Any dictionaries that you pass to a request method will be merged with the
session-level values that are set. The method-level parameters override session
parameters.
Note, however, that method-level parameters will *not* be persisted across
requests, even if using a session. This example will only send the cookies
with the first request, but not the second::
s = requests.Session()
r = s.get('http://httpbin.org/cookies', cookies={'from-my': 'browser'})
print(r.text)
# '{"cookies": {"from-my": "browser"}}'
r = s.get('http://httpbin.org/cookies')
print(r.text)
# '{"cookies": {}}'
If you want to manually add cookies to your session, use the
:ref:`Cookie utility functions <api-cookies>` to manipulate
:attr:`Session.cookies <requests.Session.cookies>`.
Sessions can also be used as context managers::
with requests.Session() as s:
s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')
This will make sure the session is closed as soon as the ``with`` block is
exited, even if unhandled exceptions occurred.
.. admonition:: Remove a Value From a Dict Parameter
Sometimes you'll want to omit session-level keys from a dict parameter. To
do this, you simply set that key's value to ``None`` in the method-level
parameter. It will automatically be omitted.
All values that are contained within a session are directly available to you.
See the :ref:`Session API Docs <sessionapi>` to learn more.
.. _request-and-response-objects:
Request and Response Objects
----------------------------
Whenever a call is made to ``requests.get()`` and friends, you are doing two
major things. First, you are constructing a ``Request`` object which will be
sent off to a server to request or query some resource. Second, a ``Response``
object is generated once Requests gets a response back from the server.
The ``Response`` object contains all of the information returned by the server and
also contains the ``Request`` object you created originally. Here is a simple
request to get some very important information from Wikipedia's servers::
>>> r = requests.get('http://en.wikipedia.org/wiki/Monty_Python')
If we want to access the headers the server sent back to us, we do this::
>>> r.headers
{'content-length': '56170', 'x-content-type-options': 'nosniff', 'x-cache':
'HIT from cp1006.eqiad.wmnet, MISS from cp1010.eqiad.wmnet', 'content-encoding':
'gzip', 'age': '3080', 'content-language': 'en', 'vary': 'Accept-Encoding,Cookie',
'server': 'Apache', 'last-modified': 'Wed, 13 Jun 2012 01:33:50 GMT',
'connection': 'close', 'cache-control': 'private, s-maxage=0, max-age=0,
must-revalidate', 'date': 'Thu, 14 Jun 2012 12:59:39 GMT', 'content-type':
'text/html; charset=UTF-8', 'x-cache-lookup': 'HIT from cp1006.eqiad.wmnet:3128,
MISS from cp1010.eqiad.wmnet:80'}
However, if we want to get the headers we sent the server, we simply access the
request, and then the request's headers::
>>> r.request.headers
{'Accept-Encoding': 'identity, deflate, compress, gzip',
'Accept': '*/*', 'User-Agent': 'python-requests/1.2.0'}
.. _prepared-requests:
Prepared Requests
-----------------
Whenever you receive a :class:`Response <requests.Response>` object
from an API call or a Session call, the ``request`` attribute is actually the
``PreparedRequest`` that was used. In some cases you may wish to do some extra
work to the body or headers (or anything else really) before sending a
request. The simple recipe for this is the following::
from requests import Request, Session
s = Session()
req = Request('POST', url, data=data, headers=headers)
prepped = req.prepare()
# do something with prepped.body
prepped.body = 'No, I want exactly this as the body.'
# do something with prepped.headers
del prepped.headers['Content-Type']
resp = s.send(prepped,
stream=stream,
verify=verify,
proxies=proxies,
cert=cert,
timeout=timeout
)
print(resp.status_code)
Since you are not doing anything special with the ``Request`` object, you
prepare it immediately and modify the ``PreparedRequest`` object. You then
send that with the other parameters you would have sent to ``requests.*`` or
``Session.*``.
However, the above code will lose some of the advantages of having a Requests
:class:`Session <requests.Session>` object. In particular,
:class:`Session <requests.Session>`-level state such as cookies will
not get applied to your request. To get a
:class:`PreparedRequest <requests.PreparedRequest>` with that state
applied, replace the call to :meth:`Request.prepare()
<requests.Request.prepare>` with a call to
:meth:`Session.prepare_request() <requests.Session.prepare_request>`, like this::
from requests import Request, Session
s = Session()
req = Request('GET', url, data=data, headers=headers)
prepped = s.prepare_request(req)
# do something with prepped.body
prepped.body = 'Seriously, send exactly these bytes.'
# do something with prepped.headers
prepped.headers['Keep-Dead'] = 'parrot'
resp = s.send(prepped,
stream=stream,
verify=verify,
proxies=proxies,
cert=cert,
timeout=timeout
)
print(resp.status_code)
.. _verification:
SSL Cert Verification
---------------------
Requests verifies SSL certificates for HTTPS requests, just like a web browser.
By default, SSL verification is enabled, and Requests will throw a SSLError if
it's unable to verify the certificate::
>>> requests.get('https://requestb.in')
requests.exceptions.SSLError: hostname 'requestb.in' doesn't match either of '*.herokuapp.com', 'herokuapp.com'
I don't have SSL setup on this domain, so it throws an exception. Excellent. GitHub does though::
>>> requests.get('https://github.com')
<Response [200]>
You can pass ``verify`` the path to a CA_BUNDLE file or directory with certificates of trusted CAs::
>>> requests.get('https://github.com', verify='/path/to/certfile')
or persistent::
s = requests.Session()
s.verify = '/path/to/certfile'
.. note:: If ``verify`` is set to a path to a directory, the directory must have been processed using
the c_rehash utility supplied with OpenSSL.
This list of trusted CAs can also be specified through the ``REQUESTS_CA_BUNDLE`` environment variable.
Requests can also ignore verifying the SSL certificate if you set ``verify`` to False::
>>> requests.get('https://kennethreitz.org', verify=False)
<Response [200]>
By default, ``verify`` is set to True. Option ``verify`` only applies to host certs.
Client Side Certificates
------------------------
You can also specify a local cert to use as client side certificate, as a single
file (containing the private key and the certificate) or as a tuple of both
files' paths::
>>> requests.get('https://kennethreitz.org', cert=('/path/client.cert', '/path/client.key'))
<Response [200]>
or persistent::
s = requests.Session()
s.cert = '/path/client.cert'
If you specify a wrong path or an invalid cert, you'll get a SSLError::
>>> requests.get('https://kennethreitz.org', cert='/wrong_path/client.pem')
SSLError: [Errno 336265225] _ssl.c:347: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib
.. warning:: The private key to your local certificate *must* be unencrypted.
Currently, Requests does not support using encrypted keys.
.. _ca-certificates:
CA Certificates
---------------
By default, Requests bundles a set of root CAs that it trusts, sourced from the
`Mozilla trust store`_. However, these are only updated once for each Requests
version. This means that if you pin a Requests version your certificates can
become extremely out of date.
From Requests version 2.4.0 onwards, Requests will attempt to use certificates
from `certifi`_ if it is present on the system. This allows for users to update
their trusted certificates without having to change the code that runs on their
system.
For the sake of security we recommend upgrading certifi frequently!
.. _HTTP persistent connection: https://en.wikipedia.org/wiki/HTTP_persistent_connection
.. _connection pooling: http://urllib3.readthedocs.io/en/latest/reference/index.html#module-urllib3.connectionpool
.. _certifi: http://certifi.io/
.. _Mozilla trust store: https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt
.. _body-content-workflow:
Body Content Workflow
---------------------
By default, when you make a request, the body of the response is downloaded
immediately. You can override this behaviour and defer downloading the response
body until you access the :attr:`Response.content <requests.Response.content>`
attribute with the ``stream`` parameter::
tarball_url = 'https://github.com/requests/requests/tarball/master'
r = requests.get(tarball_url, stream=True)
At this point only the response headers have been downloaded and the connection
remains open, hence allowing us to make content retrieval conditional::
if int(r.headers['content-length']) < TOO_LONG:
content = r.content
...
You can further control the workflow by use of the :meth:`Response.iter_content() <requests.Response.iter_content>`
and :meth:`Response.iter_lines() <requests.Response.iter_lines>` methods.
Alternatively, you can read the undecoded body from the underlying
urllib3 :class:`urllib3.HTTPResponse <urllib3.response.HTTPResponse>` at
:attr:`Response.raw <requests.Response.raw>`.
If you set ``stream`` to ``True`` when making a request, Requests cannot
release the connection back to the pool unless you consume all the data or call
:meth:`Response.close <requests.Response.close>`. This can lead to
inefficiency with connections. If you find yourself partially reading request
bodies (or not reading them at all) while using ``stream=True``, you should
make the request within a ``with`` statement to ensure it's always closed::
with requests.get('http://httpbin.org/get', stream=True) as r:
# Do things with the response here.
.. _keep-alive:
Keep-Alive
----------
Excellent news — thanks to urllib3, keep-alive is 100% automatic within a session!
Any requests that you make within a session will automatically reuse the appropriate
connection!
Note that connections are only released back to the pool for reuse once all body
data has been read; be sure to either set ``stream`` to ``False`` or read the
``content`` property of the ``Response`` object.
.. _streaming-uploads:
Streaming Uploads
-----------------
Requests supports streaming uploads, which allow you to send large streams or
files without reading them into memory. To stream and upload, simply provide a
file-like object for your body::
with open('massive-body', 'rb') as f:
requests.post('http://some.url/streamed', data=f)
.. warning:: It is strongly recommended that you open files in `binary mode`_.
This is because Requests may attempt to provide the
``Content-Length`` header for you, and if it does this value will
be set to the number of *bytes* in the file. Errors may occur if
you open the file in *text mode*.
.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
.. _chunk-encoding:
Chunk-Encoded Requests
----------------------
Requests also supports Chunked transfer encoding for outgoing and incoming requests.
To send a chunk-encoded request, simply provide a generator (or any iterator without
a length) for your body::
def gen():
yield 'hi'
yield 'there'
requests.post('http://some.url/chunked', data=gen())
For chunked encoded responses, it's best to iterate over the data using
:meth:`Response.iter_content() <requests.Response.iter_content>`. In
an ideal situation you'll have set ``stream=True`` on the request, in which
case you can iterate chunk-by-chunk by calling ``iter_content`` with a ``chunk_size``
parameter of ``None``. If you want to set a maximum size of the chunk,
you can set a ``chunk_size`` parameter to any integer.
.. _multipart:
POST Multiple Multipart-Encoded Files
-------------------------------------
You can send multiple files in one request. For example, suppose you want to
upload image files to an HTML form with a multiple file field 'images'::
<input type="file" name="images" multiple="true" required="true"/>
To do that, just set files to a list of tuples of ``(form_field_name, file_info)``::
>>> url = 'http://httpbin.org/post'
>>> multiple_files = [
('images', ('foo.png', open('foo.png', 'rb'), 'image/png')),
('images', ('bar.png', open('bar.png', 'rb'), 'image/png'))]
>>> r = requests.post(url, files=multiple_files)
>>> r.text
{
...
'files': {'images': 'data:image/png;base64,iVBORw ....'}
'Content-Type': 'multipart/form-data; boundary=3131623adb2043caaeb5538cc7aa0b3a',
...
}
.. warning:: It is strongly recommended that you open files in `binary mode`_.
This is because Requests may attempt to provide the
``Content-Length`` header for you, and if it does this value will
be set to the number of *bytes* in the file. Errors may occur if
you open the file in *text mode*.
.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
.. _event-hooks:
Event Hooks
-----------
Requests has a hook system that you can use to manipulate portions of
the request process, or signal event handling.
Available hooks:
``response``:
The response generated from a Request.
You can assign a hook function on a per-request basis by passing a
``{hook_name: callback_function}`` dictionary to the ``hooks`` request
parameter::
hooks=dict(response=print_url)
That ``callback_function`` will receive a chunk of data as its first
argument.
::
def print_url(r, *args, **kwargs):
print(r.url)
If an error occurs while executing your callback, a warning is given.
If the callback function returns a value, it is assumed that it is to
replace the data that was passed in. If the function doesn't return
anything, nothing else is effected.
Let's print some request method arguments at runtime::
>>> requests.get('http://httpbin.org', hooks=dict(response=print_url))
http://httpbin.org
<Response [200]>
.. _custom-auth:
Custom Authentication
---------------------
Requests allows you to use specify your own authentication mechanism.
Any callable which is passed as the ``auth`` argument to a request method will
have the opportunity to modify the request before it is dispatched.
Authentication implementations are subclasses of :class:`AuthBase <requests.auth.AuthBase>`,
and are easy to define. Requests provides two common authentication scheme
implementations in ``requests.auth``: :class:`HTTPBasicAuth <requests.auth.HTTPBasicAuth>` and
:class:`HTTPDigestAuth <requests.auth.HTTPDigestAuth>`.
Let's pretend that we have a web service that will only respond if the
``X-Pizza`` header is set to a password value. Unlikely, but just go with it.
::
from requests.auth import AuthBase
class PizzaAuth(AuthBase):
"""Attaches HTTP Pizza Authentication to the given Request object."""
def __init__(self, username):
# setup any auth-related data here
self.username = username
def __call__(self, r):
# modify and return the request
r.headers['X-Pizza'] = self.username
return r
Then, we can make a request using our Pizza Auth::
>>> requests.get('http://pizzabin.org/admin', auth=PizzaAuth('kenneth'))
<Response [200]>
.. _streaming-requests:
Streaming Requests
------------------
With :meth:`Response.iter_lines() <requests.Response.iter_lines>` you can easily
iterate over streaming APIs such as the `Twitter Streaming
API <https://dev.twitter.com/streaming/overview>`_. Simply
set ``stream`` to ``True`` and iterate over the response with
:meth:`~requests.Response.iter_lines()`::
import json
import requests
r = requests.get('http://httpbin.org/stream/20', stream=True)
for line in r.iter_lines():
# filter out keep-alive new lines
if line:
decoded_line = line.decode('utf-8')
print(json.loads(decoded_line))
When using `decode_unicode=True` with
:meth:`Response.iter_lines() <requests.Response.iter_lines>` or
:meth:`Response.iter_content() <requests.Response.iter_content>`, you'll want
to provide a fallback encoding in the event the server doesn't provide one::
r = requests.get('http://httpbin.org/stream/20', stream=True)
if r.encoding is None:
r.encoding = 'utf-8'
for line in r.iter_lines(decode_unicode=True):
if line:
print(json.loads(line))
.. warning::
:meth:`~requests.Response.iter_lines()` is not reentrant safe.
Calling this method multiple times causes some of the received data
being lost. In case you need to call it from multiple places, use
the resulting iterator object instead::
lines = r.iter_lines()
# Save the first line for later or just skip it
first_line = next(lines)
for line in lines:
print(line)
.. _proxies:
Proxies
-------
If you need to use a proxy, you can configure individual requests with the
``proxies`` argument to any request method::
import requests
proxies = {
'http': 'http://10.10.1.10:3128',
'https': 'http://10.10.1.10:1080',
}
requests.get('http://example.org', proxies=proxies)
You can also configure proxies by setting the environment variables
``HTTP_PROXY`` and ``HTTPS_PROXY``.
::
$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="http://10.10.1.10:1080"
$ python
>>> import requests
>>> requests.get('http://example.org')
To use HTTP Basic Auth with your proxy, use the `http://user:password@host/` syntax::
proxies = {'http': 'http://user:pass@10.10.1.10:3128/'}
To give a proxy for a specific scheme and host, use the
`scheme://hostname` form for the key. This will match for
any request to the given scheme and exact hostname.
::
proxies = {'http://10.20.1.128': 'http://10.10.1.10:5323'}
Note that proxy URLs must include the scheme.
SOCKS
^^^^^
.. versionadded:: 2.10.0
In addition to basic HTTP proxies, Requests also supports proxies using the
SOCKS protocol. This is an optional feature that requires that additional
third-party libraries be installed before use.
You can get the dependencies for this feature from ``pip``:
.. code-block:: bash
$ pip install requests[socks]
Once you've installed those dependencies, using a SOCKS proxy is just as easy
as using a HTTP one::
proxies = {
'http': 'socks5://user:pass@host:port',
'https': 'socks5://user:pass@host:port'
}
Using the scheme ``socks5`` causes the DNS resolution to happen on the client, rather than on the proxy server. This is in line with curl, which uses the scheme to decide whether to do the DNS resolution on the client or proxy. If you want to resolve the domains on the proxy server, use ``socks5h`` as the scheme.
.. _compliance:
Compliance
----------
Requests is intended to be compliant with all relevant specifications and
RFCs where that compliance will not cause difficulties for users. This
attention to the specification can lead to some behaviour that may seem
unusual to those not familiar with the relevant specification.
Encodings
^^^^^^^^^
When you receive a response, Requests makes a guess at the encoding to
use for decoding the response when you access the :attr:`Response.text
<requests.Response.text>` attribute. Requests will first check for an
encoding in the HTTP header, and if none is present, will use `chardet
<http://pypi.python.org/pypi/chardet>`_ to attempt to guess the encoding.
The only time Requests will not do this is if no explicit charset
is present in the HTTP headers **and** the ``Content-Type``
header contains ``text``. In this situation, `RFC 2616
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1>`_ specifies
that the default charset must be ``ISO-8859-1``. Requests follows the
specification in this case. If you require a different encoding, you can
manually set the :attr:`Response.encoding <requests.Response.encoding>`
property, or use the raw :attr:`Response.content <requests.Response.content>`.
.. _http-verbs:
HTTP Verbs
----------
Requests provides access to almost the full range of HTTP verbs: GET, OPTIONS,
HEAD, POST, PUT, PATCH and DELETE. The following provides detailed examples of
using these various verbs in Requests, using the GitHub API.
We will begin with the verb most commonly used: GET. HTTP GET is an idempotent
method that returns a resource from a given URL. As a result, it is the verb
you ought to use when attempting to retrieve data from a web location. An
example usage would be attempting to get information about a specific commit
from GitHub. Suppose we wanted commit ``a050faf`` on Requests. We would get it
like so::
>>> import requests
>>> r = requests.get('https://api.github.com/repos/requests/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad')
We should confirm that GitHub responded correctly. If it has, we want to work
out what type of content it is. Do this like so::
>>> if r.status_code == requests.codes.ok:
... print(r.headers['content-type'])
...
application/json; charset=utf-8
So, GitHub returns JSON. That's great, we can use the :meth:`r.json
<requests.Response.json>` method to parse it into Python objects.
::
>>> commit_data = r.json()
>>> print(commit_data.keys())
[u'committer', u'author', u'url', u'tree', u'sha', u'parents', u'message']
>>> print(commit_data[u'committer'])
{u'date': u'2012-05-10T11:10:50-07:00', u'email': u'me@kennethreitz.com', u'name': u'Kenneth Reitz'}
>>> print(commit_data[u'message'])
makin' history
So far, so simple. Well, let's investigate the GitHub API a little bit. Now,
we could look at the documentation, but we might have a little more fun if we
use Requests instead. We can take advantage of the Requests OPTIONS verb to
see what kinds of HTTP methods are supported on the url we just used.
::
>>> verbs = requests.options(r.url)
>>> verbs.status_code
500
Uh, what? That's unhelpful! Turns out GitHub, like many API providers, don't
actually implement the OPTIONS method. This is an annoying oversight, but it's
OK, we can just use the boring documentation. If GitHub had correctly
implemented OPTIONS, however, they should return the allowed methods in the
headers, e.g.
::
>>> verbs = requests.options('http://a-good-website.com/api/cats')
>>> print(verbs.headers['allow'])
GET,HEAD,POST,OPTIONS
Turning to the documentation, we see that the only other method allowed for
commits is POST, which creates a new commit. As we're using the Requests repo,
we should probably avoid making ham-handed POSTS to it. Instead, let's play
with the Issues feature of GitHub.
This documentation was added in response to
`Issue #482 <https://github.com/requests/requests/issues/482>`_. Given that
this issue already exists, we will use it as an example. Let's start by getting it.
::
>>> r = requests.get('https://api.github.com/repos/requests/requests/issues/482')
>>> r.status_code
200
>>> issue = json.loads(r.text)
>>> print(issue[u'title'])
Feature any http verb in docs
>>> print(issue[u'comments'])
3
Cool, we have three comments. Let's take a look at the last of them.
::
>>> r = requests.get(r.url + u'/comments')
>>> r.status_code
200
>>> comments = r.json()
>>> print(comments[0].keys())
[u'body', u'url', u'created_at', u'updated_at', u'user', u'id']
>>> print(comments[2][u'body'])
Probably in the "advanced" section
Well, that seems like a silly place. Let's post a comment telling the poster
that he's silly. Who is the poster, anyway?
::
>>> print(comments[2][u'user'][u'login'])
kennethreitz
OK, so let's tell this Kenneth guy that we think this example should go in the
quickstart guide instead. According to the GitHub API doc, the way to do this
is to POST to the thread. Let's do it.
::
>>> body = json.dumps({u"body": u"Sounds great! I'll get right on it!"})
>>> url = u"https://api.github.com/repos/requests/requests/issues/482/comments"
>>> r = requests.post(url=url, data=body)
>>> r.status_code
404
Huh, that's weird. We probably need to authenticate. That'll be a pain, right?
Wrong. Requests makes it easy to use many forms of authentication, including
the very common Basic Auth.
::
>>> from requests.auth import HTTPBasicAuth
>>> auth = HTTPBasicAuth('fake@example.com', 'not_a_real_password')
>>> r = requests.post(url=url, data=body, auth=auth)
>>> r.status_code
201
>>> content = r.json()
>>> print(content[u'body'])
Sounds great! I'll get right on it.
Brilliant. Oh, wait, no! I meant to add that it would take me a while, because
I had to go feed my cat. If only I could edit this comment! Happily, GitHub
allows us to use another HTTP verb, PATCH, to edit this comment. Let's do
that.
::
>>> print(content[u"id"])
5804413
>>> body = json.dumps({u"body": u"Sounds great! I'll get right on it once I feed my cat."})
>>> url = u"https://api.github.com/repos/requests/requests/issues/comments/5804413"
>>> r = requests.patch(url=url, data=body, auth=auth)
>>> r.status_code
200
Excellent. Now, just to torture this Kenneth guy, I've decided to let him
sweat and not tell him that I'm working on this. That means I want to delete
this comment. GitHub lets us delete comments using the incredibly aptly named
DELETE method. Let's get rid of it.
::
>>> r = requests.delete(url=url, auth=auth)
>>> r.status_code
204
>>> r.headers['status']
'204 No Content'
Excellent. All gone. The last thing I want to know is how much of my ratelimit
I've used. Let's find out. GitHub sends that information in the headers, so
rather than download the whole page I'll send a HEAD request to get the
headers.
::
>>> r = requests.head(url=url, auth=auth)
>>> print(r.headers)
...
'x-ratelimit-remaining': '4995'
'x-ratelimit-limit': '5000'
...
Excellent. Time to write a Python program that abuses the GitHub API in all
kinds of exciting ways, 4995 more times.
.. _custom-verbs:
Custom Verbs
------------
From time to time you may be working with a server that, for whatever reason,
allows use or even requires use of HTTP verbs not covered above. One example of
this would be the MKCOL method some WEBDAV servers use. Do not fret, these can
still be used with Requests. These make use of the built-in ``.request``
method. For example::
>>> r = requests.request('MKCOL', url, data=data)
>>> r.status_code
200 # Assuming your call was correct
Utilising this, you can make use of any method verb that your server allows.
.. _link-headers:
Link Headers
------------
Many HTTP APIs feature Link headers. They make APIs more self describing and
discoverable.
GitHub uses these for `pagination <http://developer.github.com/v3/#pagination>`_
in their API, for example::
>>> url = 'https://api.github.com/users/kennethreitz/repos?page=1&per_page=10'
>>> r = requests.head(url=url)
>>> r.headers['link']
'<https://api.github.com/users/kennethreitz/repos?page=2&per_page=10>; rel="next", <https://api.github.com/users/kennethreitz/repos?page=6&per_page=10>; rel="last"'
Requests will automatically parse these link headers and make them easily consumable::
>>> r.links["next"]
{'url': 'https://api.github.com/users/kennethreitz/repos?page=2&per_page=10', 'rel': 'next'}
>>> r.links["last"]
{'url': 'https://api.github.com/users/kennethreitz/repos?page=7&per_page=10', 'rel': 'last'}
.. _transport-adapters:
Transport Adapters
------------------
As of v1.0.0, Requests has moved to a modular internal design. Part of the
reason this was done was to implement Transport Adapters, originally
`described here`_. Transport Adapters provide a mechanism to define interaction
methods for an HTTP service. In particular, they allow you to apply per-service
configuration.
Requests ships with a single Transport Adapter, the :class:`HTTPAdapter
<requests.adapters.HTTPAdapter>`. This adapter provides the default Requests
interaction with HTTP and HTTPS using the powerful `urllib3`_ library. Whenever
a Requests :class:`Session <requests.Session>` is initialized, one of these is
attached to the :class:`Session <requests.Session>` object for HTTP, and one
for HTTPS.
Requests enables users to create and use their own Transport Adapters that
provide specific functionality. Once created, a Transport Adapter can be
mounted to a Session object, along with an indication of which web services
it should apply to.
::
>>> s = requests.Session()
>>> s.mount('http://www.github.com', MyAdapter())
The mount call registers a specific instance of a Transport Adapter to a
prefix. Once mounted, any HTTP request made using that session whose URL starts
with the given prefix will use the given Transport Adapter.
Many of the details of implementing a Transport Adapter are beyond the scope of
this documentation, but take a look at the next example for a simple SSL use-
case. For more than that, you might look at subclassing the
:class:`BaseAdapter <requests.adapters.BaseAdapter>`.
Example: Specific SSL Version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The Requests team has made a specific choice to use whatever SSL version is
default in the underlying library (`urllib3`_). Normally this is fine, but from
time to time, you might find yourself needing to connect to a service-endpoint
that uses a version that isn't compatible with the default.
You can use Transport Adapters for this by taking most of the existing
implementation of HTTPAdapter, and adding a parameter *ssl_version* that gets
passed-through to `urllib3`. We'll make a Transport Adapter that instructs the
library to use SSLv3::
import ssl
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
class Ssl3HttpAdapter(HTTPAdapter):
""""Transport adapter" that allows us to use SSLv3."""
def init_poolmanager(self, connections, maxsize, block=False):
self.poolmanager = PoolManager(
num_pools=connections, maxsize=maxsize,
block=block, ssl_version=ssl.PROTOCOL_SSLv3)
.. _`described here`: http://www.kennethreitz.org/essays/the-future-of-python-http
.. _`urllib3`: https://github.com/shazow/urllib3
.. _blocking-or-nonblocking:
Blocking Or Non-Blocking?
-------------------------
With the default Transport Adapter in place, Requests does not provide any kind
of non-blocking IO. The :attr:`Response.content <requests.Response.content>`
property will block until the entire response has been downloaded. If
you require more granularity, the streaming features of the library (see
:ref:`streaming-requests`) allow you to retrieve smaller quantities of the
response at a time. However, these calls will still block.
If you are concerned about the use of blocking IO, there are lots of projects
out there that combine Requests with one of Python's asynchronicity frameworks.
Two excellent examples are `grequests`_ and `requests-futures`_.
.. _`grequests`: https://github.com/kennethreitz/grequests
.. _`requests-futures`: https://github.com/ross/requests-futures
Header Ordering
---------------
In unusual circumstances you may want to provide headers in an ordered manner. If you pass an ``OrderedDict`` to the ``headers`` keyword argument, that will provide the headers with an ordering. *However*, the ordering of the default headers used by Requests will be preferred, which means that if you override default headers in the ``headers`` keyword argument, they may appear out of order compared to other headers in that keyword argument.
If this is problematic, users should consider setting the default headers on a :class:`Session <requests.Session>` object, by setting :attr:`Session <requests.Session.headers>` to a custom ``OrderedDict``. That ordering will always be preferred.
.. _timeouts:
Timeouts
--------
Most requests to external servers should have a timeout attached, in case the
server is not responding in a timely manner. By default, requests do not time
out unless a timeout value is set explicitly. Without a timeout, your code may
hang for minutes or more.
The **connect** timeout is the number of seconds Requests will wait for your
client to establish a connection to a remote machine (corresponding to the
`connect()`_) call on the socket. It's a good practice to set connect timeouts
to slightly larger than a multiple of 3, which is the default `TCP packet
retransmission window <http://www.hjp.at/doc/rfc/rfc2988.txt>`_.
Once your client has connected to the server and sent the HTTP request, the
**read** timeout is the number of seconds the client will wait for the server
to send a response. (Specifically, it's the number of seconds that the client
will wait *between* bytes sent from the server. In 99.9% of cases, this is the
time before the server sends the first byte).
If you specify a single value for the timeout, like this::
r = requests.get('https://github.com', timeout=5)
The timeout value will be applied to both the ``connect`` and the ``read``
timeouts. Specify a tuple if you would like to set the values separately::
r = requests.get('https://github.com', timeout=(3.05, 27))
If the remote server is very slow, you can tell Requests to wait forever for
a response, by passing None as a timeout value and then retrieving a cup of
coffee.
::
r = requests.get('https://github.com', timeout=None)
.. _`connect()`: http://linux.die.net/man/2/connect

View File

@@ -0,0 +1,144 @@
.. _authentication:
Authentication
==============
This document discusses using various kinds of authentication with Requests.
Many web services require authentication, and there are many different types.
Below, we outline various forms of authentication available in Requests, from
the simple to the complex.
Basic Authentication
--------------------
Many web services that require authentication accept HTTP Basic Auth. This is
the simplest kind, and Requests supports it straight out of the box.
Making requests with HTTP Basic Auth is very simple::
>>> from requests.auth import HTTPBasicAuth
>>> requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass'))
<Response [200]>
In fact, HTTP Basic Auth is so common that Requests provides a handy shorthand
for using it::
>>> requests.get('https://api.github.com/user', auth=('user', 'pass'))
<Response [200]>
Providing the credentials in a tuple like this is exactly the same as the
``HTTPBasicAuth`` example above.
netrc Authentication
~~~~~~~~~~~~~~~~~~~~
If no authentication method is given with the ``auth`` argument, Requests will
attempt to get the authentication credentials for the URL's hostname from the
user's netrc file. The netrc file overrides raw HTTP authentication headers
set with `headers=`.
If credentials for the hostname are found, the request is sent with HTTP Basic
Auth.
Digest Authentication
---------------------
Another very popular form of HTTP Authentication is Digest Authentication,
and Requests supports this out of the box as well::
>>> from requests.auth import HTTPDigestAuth
>>> url = 'http://httpbin.org/digest-auth/auth/user/pass'
>>> requests.get(url, auth=HTTPDigestAuth('user', 'pass'))
<Response [200]>
OAuth 1 Authentication
----------------------
A common form of authentication for several web APIs is OAuth. The ``requests-oauthlib``
library allows Requests users to easily make OAuth 1 authenticated requests::
>>> import requests
>>> from requests_oauthlib import OAuth1
>>> url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
>>> auth = OAuth1('YOUR_APP_KEY', 'YOUR_APP_SECRET',
... 'USER_OAUTH_TOKEN', 'USER_OAUTH_TOKEN_SECRET')
>>> requests.get(url, auth=auth)
<Response [200]>
For more information on how to OAuth flow works, please see the official `OAuth`_ website.
For examples and documentation on requests-oauthlib, please see the `requests_oauthlib`_
repository on GitHub
OAuth 2 and OpenID Connect Authentication
-----------------------------------------
The ``requests-oauthlib`` library also handles OAuth 2, the authentication mechanism
underpinning OpenID Connect. See the `requests-oauthlib OAuth2 documentation`_ for
details of the various OAuth 2 credential management flows:
* `Web Application Flow`_
* `Mobile Application Flow`_
* `Legacy Application Flow`_
* `Backend Application Flow`_
Other Authentication
--------------------
Requests is designed to allow other forms of authentication to be easily and
quickly plugged in. Members of the open-source community frequently write
authentication handlers for more complicated or less commonly-used forms of
authentication. Some of the best have been brought together under the
`Requests organization`_, including:
- Kerberos_
- NTLM_
If you want to use any of these forms of authentication, go straight to their
GitHub page and follow the instructions.
New Forms of Authentication
---------------------------
If you can't find a good implementation of the form of authentication you
want, you can implement it yourself. Requests makes it easy to add your own
forms of authentication.
To do so, subclass :class:`AuthBase <requests.auth.AuthBase>` and implement the
``__call__()`` method::
>>> import requests
>>> class MyAuth(requests.auth.AuthBase):
... def __call__(self, r):
... # Implement my authentication
... return r
...
>>> url = 'http://httpbin.org/get'
>>> requests.get(url, auth=MyAuth())
<Response [200]>
When an authentication handler is attached to a request,
it is called during request setup. The ``__call__`` method must therefore do
whatever is required to make the authentication work. Some forms of
authentication will additionally add hooks to provide further functionality.
Further examples can be found under the `Requests organization`_ and in the
``auth.py`` file.
.. _OAuth: http://oauth.net/
.. _requests_oauthlib: https://github.com/requests/requests-oauthlib
.. _requests-oauthlib OAuth2 documentation: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html
.. _Web Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow
.. _Mobile Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#mobile-application-flow
.. _Legacy Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#legacy-application-flow
.. _Backend Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow
.. _Kerberos: https://github.com/requests/requests-kerberos
.. _NTLM: https://github.com/requests/requests-ntlm
.. _Requests organization: https://github.com/requests

40
docs/user/install.rst Normal file
View File

@@ -0,0 +1,40 @@
.. _install:
Installation of Requests
========================
This part of the documentation covers the installation of Requests.
The first step to using any software package is getting it properly installed.
$ pip install requests
----------------------
To install Requests, simply run this simple command in your terminal of choice::
$ pip install requests
If you don't have `pip <https://pip.pypa.io>`_ installed (tisk tisk!),
`this Python installation guide <http://docs.python-guide.org/en/latest/starting/installation/>`_
can guide you through the process.
Get the Source Code
-------------------
Requests is actively developed on GitHub, where the code is
`always available <https://github.com/requests/requests>`_.
You can either clone the public repository::
$ git clone git://github.com/requests/requests.git
Or, download the `tarball <https://github.com/requests/requests/tarball/master>`_::
$ curl -OL https://github.com/requests/requests/tarball/master
# optionally, zipball is also available (for Windows users).
Once you have a copy of the source, you can embed it in your own Python
package, or install it into your site-packages easily::
$ cd requests
$ pip install .

45
docs/user/intro.rst Normal file
View File

@@ -0,0 +1,45 @@
.. _introduction:
Introduction
============
Philosophy
----------
Requests was developed with a few :pep:`20` idioms in mind.
#. Beautiful is better than ugly.
#. Explicit is better than implicit.
#. Simple is better than complex.
#. Complex is better than complicated.
#. Readability counts.
All contributions to Requests should keep these important rules in mind.
.. _`apache2`:
Apache2 License
---------------
A large number of open source projects you find today are `GPL Licensed`_.
While the GPL has its time and place, it should most certainly not be your
go-to license for your next open source project.
A project that is released as GPL cannot be used in any commercial product
without the product itself also being offered as open source.
The MIT, BSD, ISC, and Apache2 licenses are great alternatives to the GPL
that allow your open-source software to be used freely in proprietary,
closed-source software.
Requests is released under terms of `Apache2 License`_.
.. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php
.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.0
Requests License
----------------
.. include:: ../../LICENSE

545
docs/user/quickstart.rst Normal file
View File

@@ -0,0 +1,545 @@
.. _quickstart:
Quickstart
==========
.. module:: requests.models
Eager to get started? This page gives a good introduction in how to get started
with Requests.
First, make sure that:
* Requests is :ref:`installed <install>`
* Requests is :ref:`up-to-date <updates>`
Let's get started with some simple examples.
Make a Request
--------------
Making a request with Requests is very simple.
Begin by importing the Requests module::
>>> import requests
Now, let's try to get a webpage. For this example, let's get GitHub's public
timeline::
>>> r = requests.get('https://api.github.com/events')
Now, we have a :class:`Response <requests.Response>` object called ``r``. We can
get all the information we need from this object.
Requests' simple API means that all forms of HTTP request are as obvious. For
example, this is how you make an HTTP POST request::
>>> r = requests.post('http://httpbin.org/post', data = {'key':'value'})
Nice, right? What about the other HTTP request types: PUT, DELETE, HEAD and
OPTIONS? These are all just as simple::
>>> r = requests.put('http://httpbin.org/put', data = {'key':'value'})
>>> r = requests.delete('http://httpbin.org/delete')
>>> r = requests.head('http://httpbin.org/get')
>>> r = requests.options('http://httpbin.org/get')
That's all well and good, but it's also only the start of what Requests can
do.
Passing Parameters In URLs
--------------------------
You often want to send some sort of data in the URL's query string. If
you were constructing the URL by hand, this data would be given as key/value
pairs in the URL after a question mark, e.g. ``httpbin.org/get?key=val``.
Requests allows you to provide these arguments as a dictionary of strings,
using the ``params`` keyword argument. As an example, if you wanted to pass
``key1=value1`` and ``key2=value2`` to ``httpbin.org/get``, you would use the
following code::
>>> payload = {'key1': 'value1', 'key2': 'value2'}
>>> r = requests.get('http://httpbin.org/get', params=payload)
You can see that the URL has been correctly encoded by printing the URL::
>>> print(r.url)
http://httpbin.org/get?key2=value2&key1=value1
Note that any dictionary key whose value is ``None`` will not be added to the
URL's query string.
You can also pass a list of items as a value::
>>> payload = {'key1': 'value1', 'key2': ['value2', 'value3']}
>>> r = requests.get('http://httpbin.org/get', params=payload)
>>> print(r.url)
http://httpbin.org/get?key1=value1&key2=value2&key2=value3
Response Content
----------------
We can read the content of the server's response. Consider the GitHub timeline
again::
>>> import requests
>>> r = requests.get('https://api.github.com/events')
>>> r.text
u'[{"repository":{"open_issues":0,"url":"https://github.com/...
Requests will automatically decode content from the server. Most unicode
charsets are seamlessly decoded.
When you make a request, Requests makes educated guesses about the encoding of
the response based on the HTTP headers. The text encoding guessed by Requests
is used when you access ``r.text``. You can find out what encoding Requests is
using, and change it, using the ``r.encoding`` property::
>>> r.encoding
'utf-8'
>>> r.encoding = 'ISO-8859-1'
If you change the encoding, Requests will use the new value of ``r.encoding``
whenever you call ``r.text``. You might want to do this in any situation where
you can apply special logic to work out what the encoding of the content will
be. For example, HTTP and XML have the ability to specify their encoding in
their body. In situations like this, you should use ``r.content`` to find the
encoding, and then set ``r.encoding``. This will let you use ``r.text`` with
the correct encoding.
Requests will also use custom encodings in the event that you need them. If
you have created your own encoding and registered it with the ``codecs``
module, you can simply use the codec name as the value of ``r.encoding`` and
Requests will handle the decoding for you.
Binary Response Content
-----------------------
You can also access the response body as bytes, for non-text requests::
>>> r.content
b'[{"repository":{"open_issues":0,"url":"https://github.com/...
The ``gzip`` and ``deflate`` transfer-encodings are automatically decoded for you.
For example, to create an image from binary data returned by a request, you can
use the following code::
>>> from PIL import Image
>>> from io import BytesIO
>>> i = Image.open(BytesIO(r.content))
JSON Response Content
---------------------
There's also a builtin JSON decoder, in case you're dealing with JSON data::
>>> import requests
>>> r = requests.get('https://api.github.com/events')
>>> r.json()
[{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...
In case the JSON decoding fails, ``r.json()`` raises an exception. For example, if
the response gets a 204 (No Content), or if the response contains invalid JSON,
attempting ``r.json()`` raises ``ValueError: No JSON object could be decoded``.
It should be noted that the success of the call to ``r.json()`` does **not**
indicate the success of the response. Some servers may return a JSON object in a
failed response (e.g. error details with HTTP 500). Such JSON will be decoded
and returned. To check that a request is successful, use
``r.raise_for_status()`` or check ``r.status_code`` is what you expect.
Raw Response Content
--------------------
In the rare case that you'd like to get the raw socket response from the
server, you can access ``r.raw``. If you want to do this, make sure you set
``stream=True`` in your initial request. Once you do, you can do this::
>>> r = requests.get('https://api.github.com/events', stream=True)
>>> r.raw
<requests.packages.urllib3.response.HTTPResponse object at 0x101194810>
>>> r.raw.read(10)
'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'
In general, however, you should use a pattern like this to save what is being
streamed to a file::
with open(filename, 'wb') as fd:
for chunk in r.iter_content(chunk_size=128):
fd.write(chunk)
Using ``Response.iter_content`` will handle a lot of what you would otherwise
have to handle when using ``Response.raw`` directly. When streaming a
download, the above is the preferred and recommended way to retrieve the
content. Note that ``chunk_size`` can be freely adjusted to a number that
may better fit your use cases.
Custom Headers
--------------
If you'd like to add HTTP headers to a request, simply pass in a ``dict`` to the
``headers`` parameter.
For example, we didn't specify our user-agent in the previous example::
>>> url = 'https://api.github.com/some/endpoint'
>>> headers = {'user-agent': 'my-app/0.0.1'}
>>> r = requests.get(url, headers=headers)
Note: Custom headers are given less precedence than more specific sources of information. For instance:
* Authorization headers set with `headers=` will be overridden if credentials
are specified in ``.netrc``, which in turn will be overridden by the ``auth=``
parameter.
* Authorization headers will be removed if you get redirected off-host.
* Proxy-Authorization headers will be overridden by proxy credentials provided in the URL.
* Content-Length headers will be overridden when we can determine the length of the content.
Furthermore, Requests does not change its behavior at all based on which custom headers are specified. The headers are simply passed on into the final request.
Note: All header values must be a ``string``, bytestring, or unicode. While permitted, it's advised to avoid passing unicode header values.
More complicated POST requests
------------------------------
Typically, you want to send some form-encoded data — much like an HTML form.
To do this, simply pass a dictionary to the ``data`` argument. Your
dictionary of data will automatically be form-encoded when the request is made::
>>> payload = {'key1': 'value1', 'key2': 'value2'}
>>> r = requests.post("http://httpbin.org/post", data=payload)
>>> print(r.text)
{
...
"form": {
"key2": "value2",
"key1": "value1"
},
...
}
You can also pass a list of tuples to the ``data`` argument. This is particularly
useful when the form has multiple elements that use the same key::
>>> payload = (('key1', 'value1'), ('key1', 'value2'))
>>> r = requests.post('http://httpbin.org/post', data=payload)
>>> print(r.text)
{
...
"form": {
"key1": [
"value1",
"value2"
]
},
...
}
There are times that you may want to send data that is not form-encoded. If
you pass in a ``string`` instead of a ``dict``, that data will be posted directly.
For example, the GitHub API v3 accepts JSON-Encoded POST/PATCH data::
>>> import json
>>> url = 'https://api.github.com/some/endpoint'
>>> payload = {'some': 'data'}
>>> r = requests.post(url, data=json.dumps(payload))
Instead of encoding the ``dict`` yourself, you can also pass it directly using
the ``json`` parameter (added in version 2.4.2) and it will be encoded automatically::
>>> url = 'https://api.github.com/some/endpoint'
>>> payload = {'some': 'data'}
>>> r = requests.post(url, json=payload)
POST a Multipart-Encoded File
-----------------------------
Requests makes it simple to upload Multipart-encoded files::
>>> url = 'http://httpbin.org/post'
>>> files = {'file': open('report.xls', 'rb')}
>>> r = requests.post(url, files=files)
>>> r.text
{
...
"files": {
"file": "<censored...binary...data>"
},
...
}
You can set the filename, content_type and headers explicitly::
>>> url = 'http://httpbin.org/post'
>>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}
>>> r = requests.post(url, files=files)
>>> r.text
{
...
"files": {
"file": "<censored...binary...data>"
},
...
}
If you want, you can send strings to be received as files::
>>> url = 'http://httpbin.org/post'
>>> files = {'file': ('report.csv', 'some,data,to,send\nanother,row,to,send\n')}
>>> r = requests.post(url, files=files)
>>> r.text
{
...
"files": {
"file": "some,data,to,send\\nanother,row,to,send\\n"
},
...
}
In the event you are posting a very large file as a ``multipart/form-data``
request, you may want to stream the request. By default, ``requests`` does not
support this, but there is a separate package which does -
``requests-toolbelt``. You should read `the toolbelt's documentation
<https://toolbelt.readthedocs.io>`_ for more details about how to use it.
For sending multiple files in one request refer to the :ref:`advanced <advanced>`
section.
.. warning:: It is strongly recommended that you open files in `binary mode`_.
This is because Requests may attempt to provide the
``Content-Length`` header for you, and if it does this value will
be set to the number of *bytes* in the file. Errors may occur if
you open the file in *text mode*.
.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
Response Status Codes
---------------------
We can check the response status code::
>>> r = requests.get('http://httpbin.org/get')
>>> r.status_code
200
Requests also comes with a built-in status code lookup object for easy
reference::
>>> r.status_code == requests.codes.ok
True
If we made a bad request (a 4XX client error or 5XX server error response), we
can raise it with
:meth:`Response.raise_for_status() <requests.Response.raise_for_status>`::
>>> bad_r = requests.get('http://httpbin.org/status/404')
>>> bad_r.status_code
404
>>> bad_r.raise_for_status()
Traceback (most recent call last):
File "requests/models.py", line 832, in raise_for_status
raise http_error
requests.exceptions.HTTPError: 404 Client Error
But, since our ``status_code`` for ``r`` was ``200``, when we call
``raise_for_status()`` we get::
>>> r.raise_for_status()
None
All is well.
Response Headers
----------------
We can view the server's response headers using a Python dictionary::
>>> r.headers
{
'content-encoding': 'gzip',
'transfer-encoding': 'chunked',
'connection': 'close',
'server': 'nginx/1.0.4',
'x-runtime': '148ms',
'etag': '"e1ca502697e5c9317743dc078f67693f"',
'content-type': 'application/json'
}
The dictionary is special, though: it's made just for HTTP headers. According to
`RFC 7230 <http://tools.ietf.org/html/rfc7230#section-3.2>`_, HTTP Header names
are case-insensitive.
So, we can access the headers using any capitalization we want::
>>> r.headers['Content-Type']
'application/json'
>>> r.headers.get('content-type')
'application/json'
It is also special in that the server could have sent the same header multiple
times with different values, but requests combines them so they can be
represented in the dictionary within a single mapping, as per
`RFC 7230 <http://tools.ietf.org/html/rfc7230#section-3.2>`_:
A recipient MAY combine multiple header fields with the same field name
into one "field-name: field-value" pair, without changing the semantics
of the message, by appending each subsequent field value to the combined
field value in order, separated by a comma.
Cookies
-------
If a response contains some Cookies, you can quickly access them::
>>> url = 'http://example.com/some/cookie/setting/url'
>>> r = requests.get(url)
>>> r.cookies['example_cookie_name']
'example_cookie_value'
To send your own cookies to the server, you can use the ``cookies``
parameter::
>>> url = 'http://httpbin.org/cookies'
>>> cookies = dict(cookies_are='working')
>>> r = requests.get(url, cookies=cookies)
>>> r.text
'{"cookies": {"cookies_are": "working"}}'
Cookies are returned in a :class:`~requests.cookies.RequestsCookieJar`,
which acts like a ``dict`` but also offers a more complete interface,
suitable for use over multiple domains or paths. Cookie jars can
also be passed in to requests::
>>> jar = requests.cookies.RequestsCookieJar()
>>> jar.set('tasty_cookie', 'yum', domain='httpbin.org', path='/cookies')
>>> jar.set('gross_cookie', 'blech', domain='httpbin.org', path='/elsewhere')
>>> url = 'http://httpbin.org/cookies'
>>> r = requests.get(url, cookies=jar)
>>> r.text
'{"cookies": {"tasty_cookie": "yum"}}'
Redirection and History
-----------------------
By default Requests will perform location redirection for all verbs except
HEAD.
We can use the ``history`` property of the Response object to track redirection.
The :attr:`Response.history <requests.Response.history>` list contains the
:class:`Response <requests.Response>` objects that were created in order to
complete the request. The list is sorted from the oldest to the most recent
response.
For example, GitHub redirects all HTTP requests to HTTPS::
>>> r = requests.get('http://github.com')
>>> r.url
'https://github.com/'
>>> r.status_code
200
>>> r.history
[<Response [301]>]
If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable
redirection handling with the ``allow_redirects`` parameter::
>>> r = requests.get('http://github.com', allow_redirects=False)
>>> r.status_code
301
>>> r.history
[]
If you're using HEAD, you can enable redirection as well::
>>> r = requests.head('http://github.com', allow_redirects=True)
>>> r.url
'https://github.com/'
>>> r.history
[<Response [301]>]
Timeouts
--------
You can tell Requests to stop waiting for a response after a given number of
seconds with the ``timeout`` parameter. Nearly all production code should use
this parameter in nearly all requests. Failure to do so can cause your program
to hang indefinitely::
>>> requests.get('http://github.com', timeout=0.001)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
requests.exceptions.Timeout: HTTPConnectionPool(host='github.com', port=80): Request timed out. (timeout=0.001)
.. admonition:: Note
``timeout`` is not a time limit on the entire response download;
rather, an exception is raised if the server has not issued a
response for ``timeout`` seconds (more precisely, if no bytes have been
received on the underlying socket for ``timeout`` seconds). If no timeout is specified explicitly, requests do
not time out.
Errors and Exceptions
---------------------
In the event of a network problem (e.g. DNS failure, refused connection, etc),
Requests will raise a :exc:`~requests.exceptions.ConnectionError` exception.
:meth:`Response.raise_for_status() <requests.Response.raise_for_status>` will
raise an :exc:`~requests.exceptions.HTTPError` if the HTTP request
returned an unsuccessful status code.
If a request times out, a :exc:`~requests.exceptions.Timeout` exception is
raised.
If a request exceeds the configured number of maximum redirections, a
:exc:`~requests.exceptions.TooManyRedirects` exception is raised.
All exceptions that Requests explicitly raises inherit from
:exc:`requests.exceptions.RequestException`.
-----------------------
Ready for more? Check out the :ref:`advanced <advanced>` section.

8722
ext/requests-logo.ai Normal file

File diff suppressed because one or more lines are too long

1
ext/requests-logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 863 KiB

2
pytest.ini Normal file
View File

@@ -0,0 +1,2 @@
[pytest]
addopts = -p no:warnings

View File

@@ -1,4 +1,121 @@
# -*- coding: utf-8 -*-
# __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP Library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET
usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> r.status_code
200
>>> 'Python is a programming language' in r.content
True
... or POST:
>>> payload = dict(key1='value1', key2='value2')
>>> r = requests.post('http://httpbin.org/post', data=payload)
>>> print(r.text)
{
...
"form": {
"key2": "value2",
"key1": "value1"
},
...
}
The other HTTP methods are supported - see `requests.api`. Full documentation
is at <http://python-requests.org>.
:copyright: (c) 2017 by Kenneth Reitz.
:license: Apache 2.0, see LICENSE for more details.
"""
import urllib3
import chardet
import warnings
from .exceptions import RequestsDependencyWarning
def check_compatibility(urllib3_version, chardet_version):
urllib3_version = urllib3_version.split('.')
assert urllib3_version != ['dev'] # Verify urllib3 isn't installed from git.
# Sometimes, urllib3 only reports its version as 16.1.
if len(urllib3_version) == 2:
urllib3_version.append('0')
# Check urllib3 for compatibility.
major, minor, patch = urllib3_version # noqa: F811
major, minor, patch = int(major), int(minor), int(patch)
# urllib3 >= 1.21.1, <= 1.22
assert major == 1
assert minor >= 21
assert minor <= 22
# Check chardet for compatibility.
major, minor, patch = chardet_version.split('.')[:3]
major, minor, patch = int(major), int(minor), int(patch)
# chardet >= 3.0.2, < 3.1.0
assert major == 3
assert minor < 1
assert patch >= 2
# Check imported dependencies for compatibility.
try:
check_compatibility(urllib3.__version__, chardet.__version__)
except (AssertionError, ValueError):
warnings.warn("urllib3 ({0}) or chardet ({1}) doesn't match a supported "
"version!".format(urllib3.__version__, chardet.__version__),
RequestsDependencyWarning)
# Attempt to enable urllib3's SNI support, if possible
try:
from urllib3.contrib import pyopenssl
pyopenssl.inject_into_urllib3()
except ImportError:
pass
# urllib3's DependencyWarnings should be silenced.
from urllib3.exceptions import DependencyWarning
warnings.simplefilter('ignore', DependencyWarning)
from .__version__ import __title__, __description__, __url__, __version__
from .__version__ import __build__, __author__, __author_email__, __license__
from .__version__ import __copyright__, __cake__
from . import utils
from . import packages
from .core import *
from .models import Request, Response, PreparedRequest
from .api import request, get, head, post, patch, put, delete, options
from .sessions import session, Session
from .status_codes import codes
from .exceptions import (
RequestException, Timeout, URLRequired,
TooManyRedirects, HTTPError, ConnectionError,
FileModeWarning, ConnectTimeout, ReadTimeout
)
# Set default logging handler to avoid "No handler found" warnings.
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(NullHandler())
# FileModeWarnings go off per the default.
warnings.simplefilter('default', FileModeWarning, append=True)

14
requests/__version__.py Normal file
View File

@@ -0,0 +1,14 @@
# .-. .-. .-. . . .-. .-. .-. .-.
# |( |- |.| | | |- `-. | `-.
# ' ' `-' `-`.`-' `-' `-' ' `-'
__title__ = 'requests'
__description__ = 'Python HTTP for Humans.'
__url__ = 'http://python-requests.org'
__version__ = '2.18.4'
__build__ = 0x021804
__author__ = 'Kenneth Reitz'
__author_email__ = 'me@kennethreitz.org'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2017 Kenneth Reitz'
__cake__ = u'\u2728 \U0001f370 \u2728'

View File

@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
"""
requests._internal_utils
~~~~~~~~~~~~~~
Provides utility functions that are consumed internally by Requests
which depend on extremely few external helpers (such as compat)
"""
from .compat import is_py2, builtin_str, str
def to_native_string(string, encoding='ascii'):
"""Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise.
"""
if isinstance(string, builtin_str):
out = string
else:
if is_py2:
out = string.encode(encoding)
else:
out = string.decode(encoding)
return out
def unicode_is_ascii(u_string):
"""Determine if unicode string only contains ASCII characters.
:param str u_string: unicode string to check. Must be unicode
and not Python 2 `str`.
:rtype: bool
"""
assert isinstance(u_string, str)
try:
u_string.encode('ascii')
return True
except UnicodeEncodeError:
return False

525
requests/adapters.py Normal file
View File

@@ -0,0 +1,525 @@
# -*- coding: utf-8 -*-
"""
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import os.path
import socket
from urllib3.poolmanager import PoolManager, proxy_from_url
from urllib3.response import HTTPResponse
from urllib3.util import Timeout as TimeoutSauce
from urllib3.util.retry import Retry
from urllib3.exceptions import ClosedPoolError
from urllib3.exceptions import ConnectTimeoutError
from urllib3.exceptions import HTTPError as _HTTPError
from urllib3.exceptions import MaxRetryError
from urllib3.exceptions import NewConnectionError
from urllib3.exceptions import ProxyError as _ProxyError
from urllib3.exceptions import ProtocolError
from urllib3.exceptions import ReadTimeoutError
from urllib3.exceptions import SSLError as _SSLError
from urllib3.exceptions import ResponseError
from .models import Response
from .compat import urlparse, basestring
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
prepend_scheme_if_needed, get_auth_from_url, urldefragauth,
select_proxy)
from .structures import CaseInsensitiveDict
from .cookies import extract_cookies_to_jar
from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError,
ProxyError, RetryError, InvalidSchema)
from .auth import _basic_auth_str
try:
from urllib3.contrib.socks import SOCKSProxyManager
except ImportError:
def SOCKSProxyManager(*args, **kwargs):
raise InvalidSchema("Missing dependencies for SOCKS support.")
DEFAULT_POOLBLOCK = False
DEFAULT_POOLSIZE = 10
DEFAULT_RETRIES = 0
DEFAULT_POOL_TIMEOUT = None
class BaseAdapter(object):
"""The Base Transport Adapter"""
def __init__(self):
super(BaseAdapter, self).__init__()
def send(self, request, stream=False, timeout=None, verify=True,
cert=None, proxies=None):
"""Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
:param timeout: (optional) How long to wait for the server to send
data before giving up, as a float, or a :ref:`(connect timeout,
read timeout) <timeouts>` tuple.
:type timeout: float or tuple
:param verify: (optional) Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use
:param cert: (optional) Any user-provided SSL certificate to be trusted.
:param proxies: (optional) The proxies dictionary to apply to the request.
"""
raise NotImplementedError
def close(self):
"""Cleans up adapter specific items."""
raise NotImplementedError
class HTTPAdapter(BaseAdapter):
"""The built-in HTTP Adapter for urllib3.
Provides a general-case interface for Requests sessions to contact HTTP and
HTTPS urls by implementing the Transport Adapter interface. This class will
usually be created by the :class:`Session <Session>` class under the
covers.
:param pool_connections: The number of urllib3 connection pools to cache.
:param pool_maxsize: The maximum number of connections to save in the pool.
:param max_retries: The maximum number of retries each connection
should attempt. Note, this applies only to failed DNS lookups, socket
connections and connection timeouts, never to requests where data has
made it to the server. By default, Requests does not retry failed
connections. If you need granular control over the conditions under
which we retry a request, import urllib3's ``Retry`` class and pass
that instead.
:param pool_block: Whether the connection pool should block for connections.
Usage::
>>> import requests
>>> s = requests.Session()
>>> a = requests.adapters.HTTPAdapter(max_retries=3)
>>> s.mount('http://', a)
"""
__attrs__ = ['max_retries', 'config', '_pool_connections', '_pool_maxsize',
'_pool_block']
def __init__(self, pool_connections=DEFAULT_POOLSIZE,
pool_maxsize=DEFAULT_POOLSIZE, max_retries=DEFAULT_RETRIES,
pool_block=DEFAULT_POOLBLOCK):
if max_retries == DEFAULT_RETRIES:
self.max_retries = Retry(0, read=False)
else:
self.max_retries = Retry.from_int(max_retries)
self.config = {}
self.proxy_manager = {}
super(HTTPAdapter, self).__init__()
self._pool_connections = pool_connections
self._pool_maxsize = pool_maxsize
self._pool_block = pool_block
self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)
def __getstate__(self):
return dict((attr, getattr(self, attr, None)) for attr in
self.__attrs__)
def __setstate__(self, state):
# Can't handle by adding 'proxy_manager' to self.__attrs__ because
# self.poolmanager uses a lambda function, which isn't pickleable.
self.proxy_manager = {}
self.config = {}
for attr, value in state.items():
setattr(self, attr, value)
self.init_poolmanager(self._pool_connections, self._pool_maxsize,
block=self._pool_block)
def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs):
"""Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param connections: The number of urllib3 connection pools to cache.
:param maxsize: The maximum number of connections to save in the pool.
:param block: Block when no free connections are available.
:param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager.
"""
# save these values for pickling
self._pool_connections = connections
self._pool_maxsize = maxsize
self._pool_block = block
self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize,
block=block, strict=True, **pool_kwargs)
def proxy_manager_for(self, proxy, **proxy_kwargs):
"""Return urllib3 ProxyManager for the given proxy.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param proxy: The proxy to return a urllib3 ProxyManager for.
:param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.
:returns: ProxyManager
:rtype: urllib3.ProxyManager
"""
if proxy in self.proxy_manager:
manager = self.proxy_manager[proxy]
elif proxy.lower().startswith('socks'):
username, password = get_auth_from_url(proxy)
manager = self.proxy_manager[proxy] = SOCKSProxyManager(
proxy,
username=username,
password=password,
num_pools=self._pool_connections,
maxsize=self._pool_maxsize,
block=self._pool_block,
**proxy_kwargs
)
else:
proxy_headers = self.proxy_headers(proxy)
manager = self.proxy_manager[proxy] = proxy_from_url(
proxy,
proxy_headers=proxy_headers,
num_pools=self._pool_connections,
maxsize=self._pool_maxsize,
block=self._pool_block,
**proxy_kwargs)
return manager
def cert_verify(self, conn, url, verify, cert):
"""Verify a SSL certificate. This method should not be called from user
code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param conn: The urllib3 connection object associated with the cert.
:param url: The requested URL.
:param verify: Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use
:param cert: The SSL certificate to verify.
"""
if url.lower().startswith('https') and verify:
cert_loc = None
# Allow self-specified cert location.
if verify is not True:
cert_loc = verify
if not cert_loc:
cert_loc = DEFAULT_CA_BUNDLE_PATH
if not cert_loc or not os.path.exists(cert_loc):
raise IOError("Could not find a suitable TLS CA certificate bundle, "
"invalid path: {0}".format(cert_loc))
conn.cert_reqs = 'CERT_REQUIRED'
if not os.path.isdir(cert_loc):
conn.ca_certs = cert_loc
else:
conn.ca_cert_dir = cert_loc
else:
conn.cert_reqs = 'CERT_NONE'
conn.ca_certs = None
conn.ca_cert_dir = None
if cert:
if not isinstance(cert, basestring):
conn.cert_file = cert[0]
conn.key_file = cert[1]
else:
conn.cert_file = cert
conn.key_file = None
if conn.cert_file and not os.path.exists(conn.cert_file):
raise IOError("Could not find the TLS certificate file, "
"invalid path: {0}".format(conn.cert_file))
if conn.key_file and not os.path.exists(conn.key_file):
raise IOError("Could not find the TLS key file, "
"invalid path: {0}".format(conn.key_file))
def build_response(self, req, resp):
"""Builds a :class:`Response <requests.Response>` object from a urllib3
response. This should not be called from user code, and is only exposed
for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
:param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
:param resp: The urllib3 response object.
:rtype: requests.Response
"""
response = Response()
# Fallback to None if there's no status_code, for whatever reason.
response.status_code = getattr(resp, 'status', None)
# Make headers case-insensitive.
response.headers = CaseInsensitiveDict(getattr(resp, 'headers', {}))
# Set encoding.
response.encoding = get_encoding_from_headers(response.headers)
response.raw = resp
response.reason = response.raw.reason
if isinstance(req.url, bytes):
response.url = req.url.decode('utf-8')
else:
response.url = req.url
# Add new cookies from the server.
extract_cookies_to_jar(response.cookies, req, resp)
# Give the Response some context.
response.request = req
response.connection = self
return response
def get_connection(self, url, proxies=None):
"""Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param url: The URL to connect to.
:param proxies: (optional) A Requests-style dictionary of proxies used on this request.
:rtype: urllib3.ConnectionPool
"""
proxy = select_proxy(url, proxies)
if proxy:
proxy = prepend_scheme_if_needed(proxy, 'http')
proxy_manager = self.proxy_manager_for(proxy)
conn = proxy_manager.connection_from_url(url)
else:
# Only scheme should be lower case
parsed = urlparse(url)
url = parsed.geturl()
conn = self.poolmanager.connection_from_url(url)
return conn
def close(self):
"""Disposes of any internal state.
Currently, this closes the PoolManager and any active ProxyManager,
which closes any pooled connections.
"""
self.poolmanager.clear()
for proxy in self.proxy_manager.values():
proxy.clear()
def request_url(self, request, proxies):
"""Obtain the url to use when making the final request.
If the message is being sent through a HTTP proxy, the full URL has to
be used. Otherwise, we should only use the path portion of the URL.
This should not be called from user code, and is only exposed for use
when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs.
:rtype: str
"""
proxy = select_proxy(request.url, proxies)
scheme = urlparse(request.url).scheme
is_proxied_http_request = (proxy and scheme != 'https')
using_socks_proxy = False
if proxy:
proxy_scheme = urlparse(proxy).scheme.lower()
using_socks_proxy = proxy_scheme.startswith('socks')
url = request.path_url
if is_proxied_http_request and not using_socks_proxy:
url = urldefragauth(request.url)
return url
def add_headers(self, request, **kwargs):
"""Add any headers needed by the connection. As of v2.0 this does
nothing by default, but is left for overriding by users that subclass
the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
This should not be called from user code, and is only exposed for use
when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param request: The :class:`PreparedRequest <PreparedRequest>` to add headers to.
:param kwargs: The keyword arguments from the call to send().
"""
pass
def proxy_headers(self, proxy):
"""Returns a dictionary of the headers to add to any request sent
through a proxy. This works with urllib3 magic to ensure that they are
correctly sent to the proxy, rather than in a tunnelled request if
CONNECT is being used.
This should not be called from user code, and is only exposed for use
when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param proxies: The url of the proxy being used for this request.
:rtype: dict
"""
headers = {}
username, password = get_auth_from_url(proxy)
if username:
headers['Proxy-Authorization'] = _basic_auth_str(username,
password)
return headers
def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
"""Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
:param timeout: (optional) How long to wait for the server to send
data before giving up, as a float, or a :ref:`(connect timeout,
read timeout) <timeouts>` tuple.
:type timeout: float or tuple or urllib3 Timeout object
:param verify: (optional) Either a boolean, in which case it controls whether
we verify the server's TLS certificate, or a string, in which case it
must be a path to a CA bundle to use
:param cert: (optional) Any user-provided SSL certificate to be trusted.
:param proxies: (optional) The proxies dictionary to apply to the request.
:rtype: requests.Response
"""
conn = self.get_connection(request.url, proxies)
self.cert_verify(conn, request.url, verify, cert)
url = self.request_url(request, proxies)
self.add_headers(request)
chunked = not (request.body is None or 'Content-Length' in request.headers)
if isinstance(timeout, tuple):
try:
connect, read = timeout
timeout = TimeoutSauce(connect=connect, read=read)
except ValueError as e:
# this may raise a string formatting error.
err = ("Invalid timeout {0}. Pass a (connect, read) "
"timeout tuple, or a single float to set "
"both timeouts to the same value".format(timeout))
raise ValueError(err)
elif isinstance(timeout, TimeoutSauce):
pass
else:
timeout = TimeoutSauce(connect=timeout, read=timeout)
try:
if not chunked:
resp = conn.urlopen(
method=request.method,
url=url,
body=request.body,
headers=request.headers,
redirect=False,
assert_same_host=False,
preload_content=False,
decode_content=False,
retries=self.max_retries,
timeout=timeout
)
# Send the request.
else:
if hasattr(conn, 'proxy_pool'):
conn = conn.proxy_pool
low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT)
try:
low_conn.putrequest(request.method,
url,
skip_accept_encoding=True)
for header, value in request.headers.items():
low_conn.putheader(header, value)
low_conn.endheaders()
for i in request.body:
low_conn.send(hex(len(i))[2:].encode('utf-8'))
low_conn.send(b'\r\n')
low_conn.send(i)
low_conn.send(b'\r\n')
low_conn.send(b'0\r\n\r\n')
# Receive the response from the server
try:
# For Python 2.7+ versions, use buffering of HTTP
# responses
r = low_conn.getresponse(buffering=True)
except TypeError:
# For compatibility with Python 2.6 versions and back
r = low_conn.getresponse()
resp = HTTPResponse.from_httplib(
r,
pool=conn,
connection=low_conn,
preload_content=False,
decode_content=False
)
except:
# If we hit any problems here, clean up the connection.
# Then, reraise so that we can handle the actual exception.
low_conn.close()
raise
except (ProtocolError, socket.error) as err:
raise ConnectionError(err, request=request)
except MaxRetryError as e:
if isinstance(e.reason, ConnectTimeoutError):
# TODO: Remove this in 3.0.0: see #2811
if not isinstance(e.reason, NewConnectionError):
raise ConnectTimeout(e, request=request)
if isinstance(e.reason, ResponseError):
raise RetryError(e, request=request)
if isinstance(e.reason, _ProxyError):
raise ProxyError(e, request=request)
if isinstance(e.reason, _SSLError):
# This branch is for urllib3 v1.22 and later.
raise SSLError(e, request=request)
raise ConnectionError(e, request=request)
except ClosedPoolError as e:
raise ConnectionError(e, request=request)
except _ProxyError as e:
raise ProxyError(e)
except (_SSLError, _HTTPError) as e:
if isinstance(e, _SSLError):
# This branch is for urllib3 versions earlier than v1.22
raise SSLError(e, request=request)
elif isinstance(e, ReadTimeoutError):
raise ReadTimeout(e, request=request)
else:
raise
return self.build_response(request, resp)

152
requests/api.py Normal file
View File

@@ -0,0 +1,152 @@
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.
:param data: (optional) Dictionary or list of tuples ``[(key, value)]`` (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
to add for the file.
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) How many seconds to wait for the server to send data
before giving up, as a float, or a :ref:`(connect timeout, read
timeout) <timeouts>` tuple.
:type timeout: float or tuple
:param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
:param verify: (optional) Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use. Defaults to ``True``.
:param stream: (optional) if ``False``, the response content will be immediately downloaded.
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
:return: :class:`Response <Response>` object
:rtype: requests.Response
Usage::
>>> import requests
>>> req = requests.request('GET', 'http://httpbin.org/get')
<Response [200]>
"""
# By using the 'with' statement we are sure the session is closed, thus we
# avoid leaving sockets open which can trigger a ResourceWarning in some
# cases, and look like a memory leak in others.
with sessions.Session() as session:
return session.request(method=method, url=url, **kwargs)
def get(url, params=None, **kwargs):
r"""Sends a GET request.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', True)
return request('get', url, params=params, **kwargs)
def options(url, **kwargs):
r"""Sends an OPTIONS request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', True)
return request('options', url, **kwargs)
def head(url, **kwargs):
r"""Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', False)
return request('head', url, **kwargs)
def post(url, data=None, json=None, **kwargs):
r"""Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request('post', url, data=data, json=json, **kwargs)
def put(url, data=None, **kwargs):
r"""Sends a PUT request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request('put', url, data=data, **kwargs)
def patch(url, data=None, **kwargs):
r"""Sends a PATCH request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request('patch', url, data=data, **kwargs)
def delete(url, **kwargs):
r"""Sends a DELETE request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request('delete', url, **kwargs)

293
requests/auth.py Normal file
View File

@@ -0,0 +1,293 @@
# -*- coding: utf-8 -*-
"""
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import os
import re
import time
import hashlib
import threading
import warnings
from base64 import b64encode
from .compat import urlparse, str, basestring
from .cookies import extract_cookies_to_jar
from ._internal_utils import to_native_string
from .utils import parse_dict_header
CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded'
CONTENT_TYPE_MULTI_PART = 'multipart/form-data'
def _basic_auth_str(username, password):
"""Returns a Basic Auth string."""
# "I want us to put a big-ol' comment on top of it that
# says that this behaviour is dumb but we need to preserve
# it because people are relying on it."
# - Lukasa
#
# These are here solely to maintain backwards compatibility
# for things like ints. This will be removed in 3.0.0.
if not isinstance(username, basestring):
warnings.warn(
"Non-string usernames will no longer be supported in Requests "
"3.0.0. Please convert the object you've passed in ({0!r}) to "
"a string or bytes object in the near future to avoid "
"problems.".format(username),
category=DeprecationWarning,
)
username = str(username)
if not isinstance(password, basestring):
warnings.warn(
"Non-string passwords will no longer be supported in Requests "
"3.0.0. Please convert the object you've passed in ({0!r}) to "
"a string or bytes object in the near future to avoid "
"problems.".format(password),
category=DeprecationWarning,
)
password = str(password)
# -- End Removal --
if isinstance(username, str):
username = username.encode('latin1')
if isinstance(password, str):
password = password.encode('latin1')
authstr = 'Basic ' + to_native_string(
b64encode(b':'.join((username, password))).strip()
)
return authstr
class AuthBase(object):
"""Base class that all auth implementations derive from"""
def __call__(self, r):
raise NotImplementedError('Auth hooks must be callable.')
class HTTPBasicAuth(AuthBase):
"""Attaches HTTP Basic Authentication to the given Request object."""
def __init__(self, username, password):
self.username = username
self.password = password
def __eq__(self, other):
return all([
self.username == getattr(other, 'username', None),
self.password == getattr(other, 'password', None)
])
def __ne__(self, other):
return not self == other
def __call__(self, r):
r.headers['Authorization'] = _basic_auth_str(self.username, self.password)
return r
class HTTPProxyAuth(HTTPBasicAuth):
"""Attaches HTTP Proxy Authentication to a given Request object."""
def __call__(self, r):
r.headers['Proxy-Authorization'] = _basic_auth_str(self.username, self.password)
return r
class HTTPDigestAuth(AuthBase):
"""Attaches HTTP Digest Authentication to the given Request object."""
def __init__(self, username, password):
self.username = username
self.password = password
# Keep state in per-thread local storage
self._thread_local = threading.local()
def init_per_thread_state(self):
# Ensure state is initialized just once per-thread
if not hasattr(self._thread_local, 'init'):
self._thread_local.init = True
self._thread_local.last_nonce = ''
self._thread_local.nonce_count = 0
self._thread_local.chal = {}
self._thread_local.pos = None
self._thread_local.num_401_calls = None
def build_digest_header(self, method, url):
"""
:rtype: str
"""
realm = self._thread_local.chal['realm']
nonce = self._thread_local.chal['nonce']
qop = self._thread_local.chal.get('qop')
algorithm = self._thread_local.chal.get('algorithm')
opaque = self._thread_local.chal.get('opaque')
hash_utf8 = None
if algorithm is None:
_algorithm = 'MD5'
else:
_algorithm = algorithm.upper()
# lambdas assume digest modules are imported at the top level
if _algorithm == 'MD5' or _algorithm == 'MD5-SESS':
def md5_utf8(x):
if isinstance(x, str):
x = x.encode('utf-8')
return hashlib.md5(x).hexdigest()
hash_utf8 = md5_utf8
elif _algorithm == 'SHA':
def sha_utf8(x):
if isinstance(x, str):
x = x.encode('utf-8')
return hashlib.sha1(x).hexdigest()
hash_utf8 = sha_utf8
KD = lambda s, d: hash_utf8("%s:%s" % (s, d))
if hash_utf8 is None:
return None
# XXX not implemented yet
entdig = None
p_parsed = urlparse(url)
#: path is request-uri defined in RFC 2616 which should not be empty
path = p_parsed.path or "/"
if p_parsed.query:
path += '?' + p_parsed.query
A1 = '%s:%s:%s' % (self.username, realm, self.password)
A2 = '%s:%s' % (method, path)
HA1 = hash_utf8(A1)
HA2 = hash_utf8(A2)
if nonce == self._thread_local.last_nonce:
self._thread_local.nonce_count += 1
else:
self._thread_local.nonce_count = 1
ncvalue = '%08x' % self._thread_local.nonce_count
s = str(self._thread_local.nonce_count).encode('utf-8')
s += nonce.encode('utf-8')
s += time.ctime().encode('utf-8')
s += os.urandom(8)
cnonce = (hashlib.sha1(s).hexdigest()[:16])
if _algorithm == 'MD5-SESS':
HA1 = hash_utf8('%s:%s:%s' % (HA1, nonce, cnonce))
if not qop:
respdig = KD(HA1, "%s:%s" % (nonce, HA2))
elif qop == 'auth' or 'auth' in qop.split(','):
noncebit = "%s:%s:%s:%s:%s" % (
nonce, ncvalue, cnonce, 'auth', HA2
)
respdig = KD(HA1, noncebit)
else:
# XXX handle auth-int.
return None
self._thread_local.last_nonce = nonce
# XXX should the partial digests be encoded too?
base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \
'response="%s"' % (self.username, realm, nonce, path, respdig)
if opaque:
base += ', opaque="%s"' % opaque
if algorithm:
base += ', algorithm="%s"' % algorithm
if entdig:
base += ', digest="%s"' % entdig
if qop:
base += ', qop="auth", nc=%s, cnonce="%s"' % (ncvalue, cnonce)
return 'Digest %s' % (base)
def handle_redirect(self, r, **kwargs):
"""Reset num_401_calls counter on redirects."""
if r.is_redirect:
self._thread_local.num_401_calls = 1
def handle_401(self, r, **kwargs):
"""
Takes the given response and tries digest-auth, if needed.
:rtype: requests.Response
"""
# If response is not 4xx, do not auth
# See https://github.com/requests/requests/issues/3772
if not 400 <= r.status_code < 500:
self._thread_local.num_401_calls = 1
return r
if self._thread_local.pos is not None:
# Rewind the file position indicator of the body to where
# it was to resend the request.
r.request.body.seek(self._thread_local.pos)
s_auth = r.headers.get('www-authenticate', '')
if 'digest' in s_auth.lower() and self._thread_local.num_401_calls < 2:
self._thread_local.num_401_calls += 1
pat = re.compile(r'digest ', flags=re.IGNORECASE)
self._thread_local.chal = parse_dict_header(pat.sub('', s_auth, count=1))
# Consume content and release the original connection
# to allow our new request to reuse the same one.
r.content
r.close()
prep = r.request.copy()
extract_cookies_to_jar(prep._cookies, r.request, r.raw)
prep.prepare_cookies(prep._cookies)
prep.headers['Authorization'] = self.build_digest_header(
prep.method, prep.url)
_r = r.connection.send(prep, **kwargs)
_r.history.append(r)
_r.request = prep
return _r
self._thread_local.num_401_calls = 1
return r
def __call__(self, r):
# Initialize per-thread state, if needed
self.init_per_thread_state()
# If we have a saved nonce, skip the 401
if self._thread_local.last_nonce:
r.headers['Authorization'] = self.build_digest_header(r.method, r.url)
try:
self._thread_local.pos = r.body.tell()
except AttributeError:
# In the case of HTTPDigestAuth being reused and the body of
# the previous request was a file-like object, pos has the
# file position of the previous body. Ensure it's set to
# None.
self._thread_local.pos = None
r.register_hook('response', self.handle_401)
r.register_hook('response', self.handle_redirect)
self._thread_local.num_401_calls = 1
return r
def __eq__(self, other):
return all([
self.username == getattr(other, 'username', None),
self.password == getattr(other, 'password', None)
])
def __ne__(self, other):
return not self == other

18
requests/certs.py Normal file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
requests.certs
~~~~~~~~~~~~~~
This module returns the preferred default CA certificate bundle. There is
only one — the one from the certifi package.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
"""
from certifi import where
if __name__ == '__main__':
print(where())

69
requests/compat.py Normal file
View File

@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
"""
requests.compat
~~~~~~~~~~~~~~~
This module handles import compatibility issues between Python 2 and
Python 3.
"""
import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except ImportError:
import json
# ---------
# Specifics
# ---------
if is_py2:
from urllib import (
quote, unquote, quote_plus, unquote_plus, urlencode, getproxies,
proxy_bypass, proxy_bypass_environment, getproxies_environment)
from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag
from urllib2 import parse_http_list
import cookielib
from Cookie import Morsel
from StringIO import StringIO
from urllib3.packages.ordered_dict import OrderedDict
builtin_str = str
bytes = str
str = unicode
basestring = basestring
numeric_types = (int, long, float)
integer_types = (int, long)
elif is_py3:
from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag
from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment
from http import cookiejar as cookielib
from http.cookies import Morsel
from io import StringIO
from collections import OrderedDict
builtin_str = str
str = str
bytes = bytes
basestring = (str, bytes)
numeric_types = (int, float)
integer_types = (int,)

542
requests/cookies.py Normal file
View File

@@ -0,0 +1,542 @@
# -*- coding: utf-8 -*-
"""
requests.cookies
~~~~~~~~~~~~~~~~
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
"""
import copy
import time
import calendar
import collections
from ._internal_utils import to_native_string
from .compat import cookielib, urlparse, urlunparse, Morsel
try:
import threading
except ImportError:
import dummy_threading as threading
class MockRequest(object):
"""Wraps a `requests.Request` to mimic a `urllib2.Request`.
The code in `cookielib.CookieJar` expects this interface in order to correctly
manage cookie policies, i.e., determine whether a cookie can be set, given the
domains of the request and the cookie.
The original request object is read-only. The client is responsible for collecting
the new headers via `get_new_headers()` and interpreting them appropriately. You
probably want `get_cookie_header`, defined below.
"""
def __init__(self, request):
self._r = request
self._new_headers = {}
self.type = urlparse(self._r.url).scheme
def get_type(self):
return self.type
def get_host(self):
return urlparse(self._r.url).netloc
def get_origin_req_host(self):
return self.get_host()
def get_full_url(self):
# Only return the response's URL if the user hadn't set the Host
# header
if not self._r.headers.get('Host'):
return self._r.url
# If they did set it, retrieve it and reconstruct the expected domain
host = to_native_string(self._r.headers['Host'], encoding='utf-8')
parsed = urlparse(self._r.url)
# Reconstruct the URL as we expect it
return urlunparse([
parsed.scheme, host, parsed.path, parsed.params, parsed.query,
parsed.fragment
])
def is_unverifiable(self):
return True
def has_header(self, name):
return name in self._r.headers or name in self._new_headers
def get_header(self, name, default=None):
return self._r.headers.get(name, self._new_headers.get(name, default))
def add_header(self, key, val):
"""cookielib has no legitimate use for this method; add it back if you find one."""
raise NotImplementedError("Cookie headers should be added with add_unredirected_header()")
def add_unredirected_header(self, name, value):
self._new_headers[name] = value
def get_new_headers(self):
return self._new_headers
@property
def unverifiable(self):
return self.is_unverifiable()
@property
def origin_req_host(self):
return self.get_origin_req_host()
@property
def host(self):
return self.get_host()
class MockResponse(object):
"""Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
...what? Basically, expose the parsed HTTP headers from the server response
the way `cookielib` expects to see them.
"""
def __init__(self, headers):
"""Make a MockResponse for `cookielib` to read.
:param headers: a httplib.HTTPMessage or analogous carrying the headers
"""
self._headers = headers
def info(self):
return self._headers
def getheaders(self, name):
self._headers.getheaders(name)
def extract_cookies_to_jar(jar, request, response):
"""Extract the cookies from the response into a CookieJar.
:param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
:param request: our own requests.Request object
:param response: urllib3.HTTPResponse object
"""
if not (hasattr(response, '_original_response') and
response._original_response):
return
# the _original_response field is the wrapped httplib.HTTPResponse object,
req = MockRequest(request)
# pull out the HTTPMessage with the headers and put it in the mock:
res = MockResponse(response._original_response.msg)
jar.extract_cookies(res, req)
def get_cookie_header(jar, request):
"""
Produce an appropriate Cookie header string to be sent with `request`, or None.
:rtype: str
"""
r = MockRequest(request)
jar.add_cookie_header(r)
return r.get_new_headers().get('Cookie')
def remove_cookie_by_name(cookiejar, name, domain=None, path=None):
"""Unsets a cookie by name, by default over all domains and paths.
Wraps CookieJar.clear(), is O(n).
"""
clearables = []
for cookie in cookiejar:
if cookie.name != name:
continue
if domain is not None and domain != cookie.domain:
continue
if path is not None and path != cookie.path:
continue
clearables.append((cookie.domain, cookie.path, cookie.name))
for domain, path, name in clearables:
cookiejar.clear(domain, path, name)
class CookieConflictError(RuntimeError):
"""There are two cookies that meet the criteria specified in the cookie jar.
Use .get and .set and include domain and path args in order to be more specific.
"""
class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
"""Compatibility class; is a cookielib.CookieJar, but exposes a dict
interface.
This is the CookieJar we create by default for requests and sessions that
don't specify one, since some clients may expect response.cookies and
session.cookies to support dict operations.
Requests does not use the dict interface internally; it's just for
compatibility with external client code. All requests code should work
out of the box with externally provided instances of ``CookieJar``, e.g.
``LWPCookieJar`` and ``FileCookieJar``.
Unlike a regular CookieJar, this class is pickleable.
.. warning:: dictionary operations that are normally O(1) may be O(n).
"""
def get(self, name, default=None, domain=None, path=None):
"""Dict-like get() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains.
.. warning:: operation is O(n), not O(1).
"""
try:
return self._find_no_duplicates(name, domain, path)
except KeyError:
return default
def set(self, name, value, **kwargs):
"""Dict-like set() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains.
"""
# support client code that unsets cookies by assignment of a None value:
if value is None:
remove_cookie_by_name(self, name, domain=kwargs.get('domain'), path=kwargs.get('path'))
return
if isinstance(value, Morsel):
c = morsel_to_cookie(value)
else:
c = create_cookie(name, value, **kwargs)
self.set_cookie(c)
return c
def iterkeys(self):
"""Dict-like iterkeys() that returns an iterator of names of cookies
from the jar.
.. seealso:: itervalues() and iteritems().
"""
for cookie in iter(self):
yield cookie.name
def keys(self):
"""Dict-like keys() that returns a list of names of cookies from the
jar.
.. seealso:: values() and items().
"""
return list(self.iterkeys())
def itervalues(self):
"""Dict-like itervalues() that returns an iterator of values of cookies
from the jar.
.. seealso:: iterkeys() and iteritems().
"""
for cookie in iter(self):
yield cookie.value
def values(self):
"""Dict-like values() that returns a list of values of cookies from the
jar.
.. seealso:: keys() and items().
"""
return list(self.itervalues())
def iteritems(self):
"""Dict-like iteritems() that returns an iterator of name-value tuples
from the jar.
.. seealso:: iterkeys() and itervalues().
"""
for cookie in iter(self):
yield cookie.name, cookie.value
def items(self):
"""Dict-like items() that returns a list of name-value tuples from the
jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a
vanilla python dict of key value pairs.
.. seealso:: keys() and values().
"""
return list(self.iteritems())
def list_domains(self):
"""Utility method to list all the domains in the jar."""
domains = []
for cookie in iter(self):
if cookie.domain not in domains:
domains.append(cookie.domain)
return domains
def list_paths(self):
"""Utility method to list all the paths in the jar."""
paths = []
for cookie in iter(self):
if cookie.path not in paths:
paths.append(cookie.path)
return paths
def multiple_domains(self):
"""Returns True if there are multiple domains in the jar.
Returns False otherwise.
:rtype: bool
"""
domains = []
for cookie in iter(self):
if cookie.domain is not None and cookie.domain in domains:
return True
domains.append(cookie.domain)
return False # there is only one domain in jar
def get_dict(self, domain=None, path=None):
"""Takes as an argument an optional domain and path and returns a plain
old Python dict of name-value pairs of cookies that meet the
requirements.
:rtype: dict
"""
dictionary = {}
for cookie in iter(self):
if (
(domain is None or cookie.domain == domain) and
(path is None or cookie.path == path)
):
dictionary[cookie.name] = cookie.value
return dictionary
def __contains__(self, name):
try:
return super(RequestsCookieJar, self).__contains__(name)
except CookieConflictError:
return True
def __getitem__(self, name):
"""Dict-like __getitem__() for compatibility with client code. Throws
exception if there are more than one cookie with name. In that case,
use the more explicit get() method instead.
.. warning:: operation is O(n), not O(1).
"""
return self._find_no_duplicates(name)
def __setitem__(self, name, value):
"""Dict-like __setitem__ for compatibility with client code. Throws
exception if there is already a cookie of that name in the jar. In that
case, use the more explicit set() method instead.
"""
self.set(name, value)
def __delitem__(self, name):
"""Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s
``remove_cookie_by_name()``.
"""
remove_cookie_by_name(self, name)
def set_cookie(self, cookie, *args, **kwargs):
if hasattr(cookie.value, 'startswith') and cookie.value.startswith('"') and cookie.value.endswith('"'):
cookie.value = cookie.value.replace('\\"', '')
return super(RequestsCookieJar, self).set_cookie(cookie, *args, **kwargs)
def update(self, other):
"""Updates this jar with cookies from another CookieJar or dict-like"""
if isinstance(other, cookielib.CookieJar):
for cookie in other:
self.set_cookie(copy.copy(cookie))
else:
super(RequestsCookieJar, self).update(other)
def _find(self, name, domain=None, path=None):
"""Requests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param path: (optional) string containing path of cookie
:return: cookie.value
"""
for cookie in iter(self):
if cookie.name == name:
if domain is None or cookie.domain == domain:
if path is None or cookie.path == path:
return cookie.value
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
def _find_no_duplicates(self, name, domain=None, path=None):
"""Both ``__get_item__`` and ``get`` call this function: it's never
used elsewhere in Requests.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param path: (optional) string containing path of cookie
:raises KeyError: if cookie is not found
:raises CookieConflictError: if there are multiple cookies
that match name and optionally domain and path
:return: cookie.value
"""
toReturn = None
for cookie in iter(self):
if cookie.name == name:
if domain is None or cookie.domain == domain:
if path is None or cookie.path == path:
if toReturn is not None: # if there are multiple cookies that meet passed in criteria
raise CookieConflictError('There are multiple cookies with name, %r' % (name))
toReturn = cookie.value # we will eventually return this as long as no cookie conflict
if toReturn:
return toReturn
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
def __getstate__(self):
"""Unlike a normal CookieJar, this class is pickleable."""
state = self.__dict__.copy()
# remove the unpickleable RLock object
state.pop('_cookies_lock')
return state
def __setstate__(self, state):
"""Unlike a normal CookieJar, this class is pickleable."""
self.__dict__.update(state)
if '_cookies_lock' not in self.__dict__:
self._cookies_lock = threading.RLock()
def copy(self):
"""Return a copy of this RequestsCookieJar."""
new_cj = RequestsCookieJar()
new_cj.update(self)
return new_cj
def _copy_cookie_jar(jar):
if jar is None:
return None
if hasattr(jar, 'copy'):
# We're dealing with an instance of RequestsCookieJar
return jar.copy()
# We're dealing with a generic CookieJar instance
new_jar = copy.copy(jar)
new_jar.clear()
for cookie in jar:
new_jar.set_cookie(copy.copy(cookie))
return new_jar
def create_cookie(name, value, **kwargs):
"""Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie").
"""
result = dict(
version=0,
name=name,
value=value,
port=None,
domain='',
path='/',
secure=False,
expires=None,
discard=True,
comment=None,
comment_url=None,
rest={'HttpOnly': None},
rfc2109=False,)
badargs = set(kwargs) - set(result)
if badargs:
err = 'create_cookie() got unexpected keyword arguments: %s'
raise TypeError(err % list(badargs))
result.update(kwargs)
result['port_specified'] = bool(result['port'])
result['domain_specified'] = bool(result['domain'])
result['domain_initial_dot'] = result['domain'].startswith('.')
result['path_specified'] = bool(result['path'])
return cookielib.Cookie(**result)
def morsel_to_cookie(morsel):
"""Convert a Morsel object into a Cookie containing the one k/v pair."""
expires = None
if morsel['max-age']:
try:
expires = int(time.time() + int(morsel['max-age']))
except ValueError:
raise TypeError('max-age: %s must be integer' % morsel['max-age'])
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
expires = calendar.timegm(
time.strptime(morsel['expires'], time_template)
)
return create_cookie(
comment=morsel['comment'],
comment_url=bool(morsel['comment']),
discard=False,
domain=morsel['domain'],
expires=expires,
name=morsel.key,
path=morsel['path'],
port=None,
rest={'HttpOnly': morsel['httponly']},
rfc2109=False,
secure=bool(morsel['secure']),
value=morsel.value,
version=morsel['version'] or 0,
)
def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True):
"""Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:param cookiejar: (optional) A cookiejar to add the cookies to.
:param overwrite: (optional) If False, will not replace cookies
already in the jar with new ones.
"""
if cookiejar is None:
cookiejar = RequestsCookieJar()
if cookie_dict is not None:
names_from_jar = [cookie.name for cookie in cookiejar]
for name in cookie_dict:
if overwrite or (name not in names_from_jar):
cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
return cookiejar
def merge_cookies(cookiejar, cookies):
"""Add cookies to cookiejar and returns a merged CookieJar.
:param cookiejar: CookieJar object to add the cookies to.
:param cookies: Dictionary or CookieJar object to be added.
"""
if not isinstance(cookiejar, cookielib.CookieJar):
raise ValueError('You can only merge into CookieJar')
if isinstance(cookies, dict):
cookiejar = cookiejar_from_dict(
cookies, cookiejar=cookiejar, overwrite=False)
elif isinstance(cookies, cookielib.CookieJar):
try:
cookiejar.update(cookies)
except AttributeError:
for cookie_in_jar in cookies:
cookiejar.set_cookie(cookie_in_jar)
return cookiejar

View File

@@ -1,472 +0,0 @@
# -*- coding: utf-8 -*-
"""
requests.core
~~~~~~~~~~~~~
This module implements the main Requests system.
:copyright: (c) 2011 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
import urllib
import urllib2
from urllib2 import HTTPError
try:
import eventlet
eventlet.monkey_patch()
except ImportError:
pass
if not 'eventlet' in locals():
try:
from gevent import monkey
monkey.patch_all()
except ImportError:
pass
from .packages.poster.encode import multipart_encode
from .packages.poster.streaminghttp import register_openers
__title__ = 'requests'
__version__ = '0.2.3'
__build__ = 0x000203
__author__ = 'Kenneth Reitz'
__license__ = 'ISC'
__copyright__ = 'Copyright 2011 Kenneth Reitz'
AUTOAUTHS = []
class _Request(urllib2.Request):
"""Hidden wrapper around the urllib2.Request object. Allows for manual
setting of HTTP methods.
"""
def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None):
urllib2.Request.__init__( self, url, data, headers, origin_req_host, unverifiable)
self.method = method
def get_method(self):
if self.method:
return self.method
return urllib2.Request.get_method(self)
class Request(object):
"""The :class:`Request` object. It carries out all functionality of
Requests. Recommended interface is with the Requests functions.
"""
_METHODS = ('GET', 'HEAD', 'PUT', 'POST', 'DELETE')
def __init__(self):
self.url = None
self.headers = dict()
self.files = None
self.method = None
self.params = {}
self.data = {}
self.response = Response()
self.auth = None
self.cookiejar = None
self.sent = False
def __repr__(self):
return '<Request [%s]>' % (self.method)
def __setattr__(self, name, value):
if (name == 'method') and (value):
if not value in self._METHODS:
raise InvalidMethod()
object.__setattr__(self, name, value)
def _checks(self):
"""Deterministic checks for consistency."""
if not self.url:
raise URLRequired
def _get_opener(self):
"""Creates appropriate opener object for urllib2."""
_handlers = []
if self.auth or self.cookiejar:
if self.auth:
authr = urllib2.HTTPPasswordMgrWithDefaultRealm()
authr.add_password(None, self.url, self.auth.username, self.auth.password)
auth_handler = urllib2.HTTPBasicAuthHandler(authr)
_handlers.append(auth_handler)
if self.cookiejar:
cookie_handler = urllib2.HTTPCookieProcessor(cookiejar)
_handlers.append(cookie_handler)
opener = urllib2.build_opener(*_handlers)
return opener.open
else:
return urllib2.urlopen
def _build_response(self, resp):
"""Build internal Response object from given response."""
self.response.status_code = resp.code
self.response.headers = resp.info().dict
self.response.content = resp.read()
self.response.url = resp.url
def send(self, anyway=False):
"""Sends the request. Returns True of successful, false if not.
If there was an HTTPError during transmission,
self.response.status_code will contain the HTTPError code.
Once a request is successfully sent, `sent` will equal True.
:param anyway: If True, request will be sent, even if it has
already been sent.
"""
self._checks()
success = False
if self.method in ('GET', 'HEAD', 'DELETE'):
if (not self.sent) or anyway:
# url encode GET params if it's a dict
if isinstance(self.params, dict):
params = urllib.urlencode(self.params)
else:
params = self.params
req = _Request(("%s?%s" % (self.url, params)), method=self.method)
if self.headers:
req.headers = self.headers
opener = self._get_opener()
try:
resp = opener(req)
self._build_response(resp)
self.response.ok = True
except urllib2.HTTPError as why:
self._build_response(why)
self.response.error = why
elif self.method == 'PUT':
if (not self.sent) or anyway:
if self.files:
register_openers()
datagen, headers = multipart_encode(self.files)
req = _Request(self.url, data=datagen, headers=headers, method='PUT')
if self.headers:
req.headers.update(self.headers)
else:
req = _Request(self.url, method='PUT')
if self.headers:
req.headers = self.headers
req.data = self.data
try:
opener = self._get_opener()
resp = opener(req)
self._build_response(resp)
self.response.ok = True
except urllib2.HTTPError as why:
self._build_response(why)
self.response.error = why
elif self.method == 'POST':
if (not self.sent) or anyway:
if self.files:
register_openers()
datagen, headers = multipart_encode(self.files)
req = _Request(self.url, data=datagen, headers=headers, method='POST')
if self.headers:
req.headers.update(self.headers)
else:
req = _Request(self.url, method='POST')
req.headers = self.headers
# url encode form data if it's a dict
if isinstance(self.data, dict):
req.data = urllib.urlencode(self.data)
else:
req.data = self.data
try:
opener = self._get_opener()
resp = opener(req)
self._build_response(resp)
self.response.ok = True
except urllib2.HTTPError as why:
self._build_response(why)
self.response.error = why
self.sent = self.response.ok
return self.sent
class Response(object):
"""The :class:`Request` object. All :class:`Request` objects contain a
:class:`Request.response <response>` attribute, which is an instance of
this class.
"""
def __init__(self):
self.content = None
self.status_code = None
self.headers = dict()
self.url = None
self.ok = False
self.error = None
def __repr__(self):
return '<Response [%s]>' % (self.status_code)
def __nonzero__(self):
"""Returns true if status_code is 'OK'."""
return not self.error
def raise_for_status(self):
"""Raises stored HTTPError if one exists."""
if self.error:
raise self.error
class AuthObject(object):
"""The :class:`AuthObject` is a simple HTTP Authentication token. When
given to a Requests function, it enables Basic HTTP Authentication for that
Request. You can also enable Authorization for domain realms with AutoAuth.
See AutoAuth for more details.
:param username: Username to authenticate with.
:param password: Password for given username.
"""
def __init__(self, username, password):
self.username = username
self.password = password
def get(url, params={}, headers={}, cookies=None, auth=None):
"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
r = Request()
r.method = 'GET'
r.url = url
r.params = params
r.headers = headers
r.cookiejar = cookies
r.auth = _detect_auth(url, auth)
r.send()
return r.response
def head(url, params={}, headers={}, cookies=None, auth=None):
"""Sends a HEAD request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
r = Request()
r.method = 'HEAD'
r.url = url
# return response object
r.params = params
r.headers = headers
r.cookiejar = cookies
r.auth = _detect_auth(url, auth)
r.send()
return r.response
def post(url, data={}, headers={}, files=None, cookies=None, auth=None):
"""Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary of POST Data to send with the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
:param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
r = Request()
r.url = url
r.method = 'POST'
r.data = data
if files:
r.files = files
r.headers = headers
r.cookiejar = cookies
r.auth = _detect_auth(url, auth)
r.send()
return r.response
def put(url, data='', headers={}, files={}, cookies=None, auth=None):
"""Sends a PUT request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Bytes of PUT Data to send with the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
:param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
r = Request()
r.url = url
r.method = 'PUT'
r.data = data
r.files = files
r.headers = headers
r.cookiejar = cookies
r.auth = _detect_auth(url, auth)
r.send()
return r.response
def delete(url, params={}, headers={}, cookies=None, auth=None):
"""Sends a DELETE request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
"""
r = Request()
r.url = url
r.method = 'DELETE'
r.headers = headers
r.cookiejar = cookies
r.auth = _detect_auth(url, auth)
r.send()
return r.response
def add_autoauth(url, authobject):
"""Registers given AuthObject to given URL domain. for auto-activation.
Once a URL is registered with an AuthObject, the configured HTTP
Authentication will be used for all requests with URLS containing the given
URL string.
Example: ::
>>> c_auth = requests.AuthObject('kennethreitz', 'xxxxxxx')
>>> requests.add_autoauth('https://convore.com/api/', c_auth)
>>> r = requests.get('https://convore.com/api/account/verify.json')
# Automatically HTTP Authenticated! Wh00t!
:param url: Base URL for given AuthObject to auto-activate for.
:param authobject: AuthObject to auto-activate.
"""
global AUTOAUTHS
AUTOAUTHS.append((url, authobject))
def _detect_auth(url, auth):
"""Returns registered AuthObject for given url if available, defaulting to
given AuthObject.
"""
return _get_autoauth(url) if not auth else auth
def _get_autoauth(url):
"""Returns registered AuthObject for given url if available."""
for (autoauth_url, auth) in AUTOAUTHS:
if autoauth_url in url:
return auth
return None
class RequestException(Exception):
"""There was an ambiguous exception that occured while handling your request."""
class AuthenticationError(RequestException):
"""The authentication credentials provided were invalid."""
class URLRequired(RequestException):
"""A valid URL is required to make a request."""
class InvalidMethod(RequestException):
"""An inappropriate method was attempted."""

122
requests/exceptions.py Normal file
View File

@@ -0,0 +1,122 @@
# -*- coding: utf-8 -*-
"""
requests.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of Requests' exceptions.
"""
from urllib3.exceptions import HTTPError as BaseHTTPError
class RequestException(IOError):
"""There was an ambiguous exception that occurred while handling your
request.
"""
def __init__(self, *args, **kwargs):
"""Initialize RequestException with `request` and `response` objects."""
response = kwargs.pop('response', None)
self.response = response
self.request = kwargs.pop('request', None)
if (response is not None and not self.request and
hasattr(response, 'request')):
self.request = self.response.request
super(RequestException, self).__init__(*args, **kwargs)
class HTTPError(RequestException):
"""An HTTP error occurred."""
class ConnectionError(RequestException):
"""A Connection error occurred."""
class ProxyError(ConnectionError):
"""A proxy error occurred."""
class SSLError(ConnectionError):
"""An SSL error occurred."""
class Timeout(RequestException):
"""The request timed out.
Catching this error will catch both
:exc:`~requests.exceptions.ConnectTimeout` and
:exc:`~requests.exceptions.ReadTimeout` errors.
"""
class ConnectTimeout(ConnectionError, Timeout):
"""The request timed out while trying to connect to the remote server.
Requests that produced this error are safe to retry.
"""
class ReadTimeout(Timeout):
"""The server did not send any data in the allotted amount of time."""
class URLRequired(RequestException):
"""A valid URL is required to make a request."""
class TooManyRedirects(RequestException):
"""Too many redirects."""
class MissingSchema(RequestException, ValueError):
"""The URL schema (e.g. http or https) is missing."""
class InvalidSchema(RequestException, ValueError):
"""See defaults.py for valid schemas."""
class InvalidURL(RequestException, ValueError):
"""The URL provided was somehow invalid."""
class InvalidHeader(RequestException, ValueError):
"""The header value provided was somehow invalid."""
class ChunkedEncodingError(RequestException):
"""The server declared chunked encoding but sent an invalid chunk."""
class ContentDecodingError(RequestException, BaseHTTPError):
"""Failed to decode response content"""
class StreamConsumedError(RequestException, TypeError):
"""The content for this response was already consumed"""
class RetryError(RequestException):
"""Custom retries logic failed"""
class UnrewindableBodyError(RequestException):
"""Requests encountered an error when trying to rewind a body"""
# Warnings
class RequestsWarning(Warning):
"""Base warning for Requests."""
pass
class FileModeWarning(RequestsWarning, DeprecationWarning):
"""A file was opened in text mode, but Requests determined its binary length."""
pass
class RequestsDependencyWarning(RequestsWarning):
"""An imported dependency doesn't match the expected version range."""
pass

120
requests/help.py Normal file
View File

@@ -0,0 +1,120 @@
"""Module containing bug report helper(s)."""
from __future__ import print_function
import json
import platform
import sys
import ssl
import idna
import urllib3
import chardet
from . import __version__ as requests_version
try:
from .packages.urllib3.contrib import pyopenssl
except ImportError:
pyopenssl = None
OpenSSL = None
cryptography = None
else:
import OpenSSL
import cryptography
def _implementation():
"""Return a dict with the Python implementation and version.
Provide both the name and the version of the Python implementation
currently running. For example, on CPython 2.7.5 it will return
{'name': 'CPython', 'version': '2.7.5'}.
This function works best on CPython and PyPy: in particular, it probably
doesn't work for Jython or IronPython. Future investigation should be done
to work out the correct shape of the code for those platforms.
"""
implementation = platform.python_implementation()
if implementation == 'CPython':
implementation_version = platform.python_version()
elif implementation == 'PyPy':
implementation_version = '%s.%s.%s' % (sys.pypy_version_info.major,
sys.pypy_version_info.minor,
sys.pypy_version_info.micro)
if sys.pypy_version_info.releaselevel != 'final':
implementation_version = ''.join([
implementation_version, sys.pypy_version_info.releaselevel
])
elif implementation == 'Jython':
implementation_version = platform.python_version() # Complete Guess
elif implementation == 'IronPython':
implementation_version = platform.python_version() # Complete Guess
else:
implementation_version = 'Unknown'
return {'name': implementation, 'version': implementation_version}
def info():
"""Generate information for a bug report."""
try:
platform_info = {
'system': platform.system(),
'release': platform.release(),
}
except IOError:
platform_info = {
'system': 'Unknown',
'release': 'Unknown',
}
implementation_info = _implementation()
urllib3_info = {'version': urllib3.__version__}
chardet_info = {'version': chardet.__version__}
pyopenssl_info = {
'version': None,
'openssl_version': '',
}
if OpenSSL:
pyopenssl_info = {
'version': OpenSSL.__version__,
'openssl_version': '%x' % OpenSSL.SSL.OPENSSL_VERSION_NUMBER,
}
cryptography_info = {
'version': getattr(cryptography, '__version__', ''),
}
idna_info = {
'version': getattr(idna, '__version__', ''),
}
# OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module.
system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None)
system_ssl_info = {
'version': '%x' % system_ssl if system_ssl is not None else ''
}
return {
'platform': platform_info,
'implementation': implementation_info,
'system_ssl': system_ssl_info,
'using_pyopenssl': pyopenssl is not None,
'pyOpenSSL': pyopenssl_info,
'urllib3': urllib3_info,
'chardet': chardet_info,
'cryptography': cryptography_info,
'idna': idna_info,
'requests': {
'version': requests_version,
},
}
def main():
"""Pretty-print the bug information as JSON."""
print(json.dumps(info(), sort_keys=True, indent=2))
if __name__ == '__main__':
main()

34
requests/hooks.py Normal file
View File

@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
"""
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
Available hooks:
``response``:
The response generated from a Request.
"""
HOOKS = ['response']
def default_hooks():
return dict((event, []) for event in HOOKS)
# TODO: response is the only one
def dispatch_hook(key, hooks, hook_data, **kwargs):
"""Dispatches a hook dictionary on a given piece of data."""
hooks = hooks or dict()
hooks = hooks.get(key)
if hooks:
if hasattr(hooks, '__call__'):
hooks = [hooks]
for hook in hooks:
_hook_data = hook(hook_data, **kwargs)
if _hook_data is not None:
hook_data = _hook_data
return hook_data

948
requests/models.py Normal file
View File

@@ -0,0 +1,948 @@
# -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import collections
import datetime
import sys
# Import encoding now, to avoid implicit import later.
# Implicit import within threads may cause LookupError when standard library is in a ZIP,
# such as in Embedded Python. See https://github.com/requests/requests/issues/3578.
import encodings.idna
from urllib3.fields import RequestField
from urllib3.filepost import encode_multipart_formdata
from urllib3.util import parse_url
from urllib3.exceptions import (
DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
from io import UnsupportedOperation
from .hooks import default_hooks
from .structures import CaseInsensitiveDict
from .auth import HTTPBasicAuth
from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar
from .exceptions import (
HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
ContentDecodingError, ConnectionError, StreamConsumedError)
from ._internal_utils import to_native_string, unicode_is_ascii
from .utils import (
guess_filename, get_auth_from_url, requote_uri,
stream_decode_response_unicode, to_key_val_list, parse_header_links,
iter_slices, guess_json_utf, super_len, check_header_validity)
from .compat import (
cookielib, urlunparse, urlsplit, urlencode, str, bytes,
is_py2, chardet, builtin_str, basestring)
from .compat import json as complexjson
from .status_codes import codes
#: The set of HTTP status codes that indicate an automatically
#: processable redirect.
REDIRECT_STATI = (
codes.moved, # 301
codes.found, # 302
codes.other, # 303
codes.temporary_redirect, # 307
codes.permanent_redirect, # 308
)
DEFAULT_REDIRECT_LIMIT = 30
CONTENT_CHUNK_SIZE = 10 * 1024
ITER_CHUNK_SIZE = 512
class RequestEncodingMixin(object):
@property
def path_url(self):
"""Build the path URL to use."""
url = []
p = urlsplit(self.url)
path = p.path
if not path:
path = '/'
url.append(path)
query = p.query
if query:
url.append('?')
url.append(query)
return ''.join(url)
@staticmethod
def _encode_params(data):
"""Encode parameters in a piece of data.
Will successfully encode parameters when passed as a dict or a list of
2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
if parameters are supplied as a dict.
"""
if isinstance(data, (str, bytes)):
return data
elif hasattr(data, 'read'):
return data
elif hasattr(data, '__iter__'):
result = []
for k, vs in to_key_val_list(data):
if isinstance(vs, basestring) or not hasattr(vs, '__iter__'):
vs = [vs]
for v in vs:
if v is not None:
result.append(
(k.encode('utf-8') if isinstance(k, str) else k,
v.encode('utf-8') if isinstance(v, str) else v))
return urlencode(result, doseq=True)
else:
return data
@staticmethod
def _encode_files(files, data):
"""Build the body for a multipart/form-data request.
Will successfully encode files when passed as a dict or a list of
tuples. Order is retained if data is a list of tuples but arbitrary
if parameters are supplied as a dict.
The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype)
or 4-tuples (filename, fileobj, contentype, custom_headers).
"""
if (not files):
raise ValueError("Files must be provided.")
elif isinstance(data, basestring):
raise ValueError("Data must not be a string.")
new_fields = []
fields = to_key_val_list(data or {})
files = to_key_val_list(files or {})
for field, val in fields:
if isinstance(val, basestring) or not hasattr(val, '__iter__'):
val = [val]
for v in val:
if v is not None:
# Don't call str() on bytestrings: in Py3 it all goes wrong.
if not isinstance(v, bytes):
v = str(v)
new_fields.append(
(field.decode('utf-8') if isinstance(field, bytes) else field,
v.encode('utf-8') if isinstance(v, str) else v))
for (k, v) in files:
# support for explicit filename
ft = None
fh = None
if isinstance(v, (tuple, list)):
if len(v) == 2:
fn, fp = v
elif len(v) == 3:
fn, fp, ft = v
else:
fn, fp, ft, fh = v
else:
fn = guess_filename(v) or k
fp = v
if isinstance(fp, (str, bytes, bytearray)):
fdata = fp
else:
fdata = fp.read()
rf = RequestField(name=k, data=fdata, filename=fn, headers=fh)
rf.make_multipart(content_type=ft)
new_fields.append(rf)
body, content_type = encode_multipart_formdata(new_fields)
return body, content_type
class RequestHooksMixin(object):
def register_hook(self, event, hook):
"""Properly register a hook."""
if event not in self.hooks:
raise ValueError('Unsupported event specified, with event name "%s"' % (event))
if isinstance(hook, collections.Callable):
self.hooks[event].append(hook)
elif hasattr(hook, '__iter__'):
self.hooks[event].extend(h for h in hook if isinstance(h, collections.Callable))
def deregister_hook(self, event, hook):
"""Deregister a previously registered hook.
Returns True if the hook existed, False if not.
"""
try:
self.hooks[event].remove(hook)
return True
except ValueError:
return False
class Request(RequestHooksMixin):
"""A user-created :class:`Request <Request>` object.
Used to prepare a :class:`PreparedRequest <PreparedRequest>`, which is sent to the server.
:param method: HTTP method to use.
:param url: URL to send.
:param headers: dictionary of headers to send.
:param files: dictionary of {filename: fileobject} files to multipart upload.
:param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place.
:param json: json for the body to attach to the request (if files or data is not specified).
:param params: dictionary of URL parameters to append to the URL.
:param auth: Auth handler or (user, pass) tuple.
:param cookies: dictionary or CookieJar of cookies to attach to this request.
:param hooks: dictionary of callback hooks, for internal usage.
Usage::
>>> import requests
>>> req = requests.Request('GET', 'http://httpbin.org/get')
>>> req.prepare()
<PreparedRequest [GET]>
"""
def __init__(self,
method=None, url=None, headers=None, files=None, data=None,
params=None, auth=None, cookies=None, hooks=None, json=None):
# Default empty dicts for dict params.
data = [] if data is None else data
files = [] if files is None else files
headers = {} if headers is None else headers
params = {} if params is None else params
hooks = {} if hooks is None else hooks
self.hooks = default_hooks()
for (k, v) in list(hooks.items()):
self.register_hook(event=k, hook=v)
self.method = method
self.url = url
self.headers = headers
self.files = files
self.data = data
self.json = json
self.params = params
self.auth = auth
self.cookies = cookies
def __repr__(self):
return '<Request [%s]>' % (self.method)
def prepare(self):
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it."""
p = PreparedRequest()
p.prepare(
method=self.method,
url=self.url,
headers=self.headers,
files=self.files,
data=self.data,
json=self.json,
params=self.params,
auth=self.auth,
cookies=self.cookies,
hooks=self.hooks,
)
return p
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
"""The fully mutable :class:`PreparedRequest <PreparedRequest>` object,
containing the exact bytes that will be sent to the server.
Generated from either a :class:`Request <Request>` object or manually.
Usage::
>>> import requests
>>> req = requests.Request('GET', 'http://httpbin.org/get')
>>> r = req.prepare()
<PreparedRequest [GET]>
>>> s = requests.Session()
>>> s.send(r)
<Response [200]>
"""
def __init__(self):
#: HTTP verb to send to the server.
self.method = None
#: HTTP URL to send the request to.
self.url = None
#: dictionary of HTTP headers.
self.headers = None
# The `CookieJar` used to create the Cookie header will be stored here
# after prepare_cookies is called
self._cookies = None
#: request body to send to the server.
self.body = None
#: dictionary of callback hooks, for internal usage.
self.hooks = default_hooks()
#: integer denoting starting position of a readable file-like body.
self._body_position = None
def prepare(self,
method=None, url=None, headers=None, files=None, data=None,
params=None, auth=None, cookies=None, hooks=None, json=None):
"""Prepares the entire request with the given parameters."""
self.prepare_method(method)
self.prepare_url(url, params)
self.prepare_headers(headers)
self.prepare_cookies(cookies)
self.prepare_body(data, files, json)
self.prepare_auth(auth, url)
# Note that prepare_auth must be last to enable authentication schemes
# such as OAuth to work on a fully prepared request.
# This MUST go after prepare_auth. Authenticators could add a hook
self.prepare_hooks(hooks)
def __repr__(self):
return '<PreparedRequest [%s]>' % (self.method)
def copy(self):
p = PreparedRequest()
p.method = self.method
p.url = self.url
p.headers = self.headers.copy() if self.headers is not None else None
p._cookies = _copy_cookie_jar(self._cookies)
p.body = self.body
p.hooks = self.hooks
p._body_position = self._body_position
return p
def prepare_method(self, method):
"""Prepares the given HTTP method."""
self.method = method
if self.method is not None:
self.method = to_native_string(self.method.upper())
@staticmethod
def _get_idna_encoded_host(host):
import idna
try:
host = idna.encode(host, uts46=True).decode('utf-8')
except idna.IDNAError:
raise UnicodeError
return host
def prepare_url(self, url, params):
"""Prepares the given HTTP URL."""
#: Accept objects that have string representations.
#: We're unable to blindly call unicode/str functions
#: as this will include the bytestring indicator (b'')
#: on python 3.x.
#: https://github.com/requests/requests/pull/2238
if isinstance(url, bytes):
url = url.decode('utf8')
else:
url = unicode(url) if is_py2 else str(url)
# Remove leading whitespaces from url
url = url.lstrip()
# Don't do any URL preparation for non-HTTP schemes like `mailto`,
# `data` etc to work around exceptions from `url_parse`, which
# handles RFC 3986 only.
if ':' in url and not url.lower().startswith('http'):
self.url = url
return
# Support for unicode domain names and paths.
try:
scheme, auth, host, port, path, query, fragment = parse_url(url)
except LocationParseError as e:
raise InvalidURL(*e.args)
if not scheme:
error = ("Invalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?")
error = error.format(to_native_string(url, 'utf8'))
raise MissingSchema(error)
if not host:
raise InvalidURL("Invalid URL %r: No host supplied" % url)
# In general, we want to try IDNA encoding the hostname if the string contains
# non-ASCII characters. This allows users to automatically get the correct IDNA
# behaviour. For strings containing only ASCII characters, we need to also verify
# it doesn't start with a wildcard (*), before allowing the unencoded hostname.
if not unicode_is_ascii(host):
try:
host = self._get_idna_encoded_host(host)
except UnicodeError:
raise InvalidURL('URL has an invalid label.')
elif host.startswith(u'*'):
raise InvalidURL('URL has an invalid label.')
# Carefully reconstruct the network location
netloc = auth or ''
if netloc:
netloc += '@'
netloc += host
if port:
netloc += ':' + str(port)
# Bare domains aren't valid URLs.
if not path:
path = '/'
if is_py2:
if isinstance(scheme, str):
scheme = scheme.encode('utf-8')
if isinstance(netloc, str):
netloc = netloc.encode('utf-8')
if isinstance(path, str):
path = path.encode('utf-8')
if isinstance(query, str):
query = query.encode('utf-8')
if isinstance(fragment, str):
fragment = fragment.encode('utf-8')
if isinstance(params, (str, bytes)):
params = to_native_string(params)
enc_params = self._encode_params(params)
if enc_params:
if query:
query = '%s&%s' % (query, enc_params)
else:
query = enc_params
url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment]))
self.url = url
def prepare_headers(self, headers):
"""Prepares the given HTTP headers."""
self.headers = CaseInsensitiveDict()
if headers:
for header in headers.items():
# Raise exception on invalid header value.
check_header_validity(header)
name, value = header
self.headers[to_native_string(name)] = value
def prepare_body(self, data, files, json=None):
"""Prepares the given HTTP body data."""
# Check if file, fo, generator, iterator.
# If not, run through normal process.
# Nottin' on you.
body = None
content_type = None
if not data and json is not None:
# urllib3 requires a bytes-like body. Python 2's json.dumps
# provides this natively, but Python 3 gives a Unicode string.
content_type = 'application/json'
body = complexjson.dumps(json)
if not isinstance(body, bytes):
body = body.encode('utf-8')
is_stream = all([
hasattr(data, '__iter__'),
not isinstance(data, (basestring, list, tuple, collections.Mapping))
])
try:
length = super_len(data)
except (TypeError, AttributeError, UnsupportedOperation):
length = None
if is_stream:
body = data
if getattr(body, 'tell', None) is not None:
# Record the current file position before reading.
# This will allow us to rewind a file in the event
# of a redirect.
try:
self._body_position = body.tell()
except (IOError, OSError):
# This differentiates from None, allowing us to catch
# a failed `tell()` later when trying to rewind the body
self._body_position = object()
if files:
raise NotImplementedError('Streamed bodies and files are mutually exclusive.')
if length:
self.headers['Content-Length'] = builtin_str(length)
else:
self.headers['Transfer-Encoding'] = 'chunked'
else:
# Multi-part file uploads.
if files:
(body, content_type) = self._encode_files(files, data)
else:
if data:
body = self._encode_params(data)
if isinstance(data, basestring) or hasattr(data, 'read'):
content_type = None
else:
content_type = 'application/x-www-form-urlencoded'
self.prepare_content_length(body)
# Add content-type if it wasn't explicitly provided.
if content_type and ('content-type' not in self.headers):
self.headers['Content-Type'] = content_type
self.body = body
def prepare_content_length(self, body):
"""Prepare Content-Length header based on request method and body"""
if body is not None:
length = super_len(body)
if length:
# If length exists, set it. Otherwise, we fallback
# to Transfer-Encoding: chunked.
self.headers['Content-Length'] = builtin_str(length)
elif self.method not in ('GET', 'HEAD') and self.headers.get('Content-Length') is None:
# Set Content-Length to 0 for methods that can have a body
# but don't provide one. (i.e. not GET or HEAD)
self.headers['Content-Length'] = '0'
def prepare_auth(self, auth, url=''):
"""Prepares the given HTTP auth data."""
# If no Auth is explicitly provided, extract it from the URL first.
if auth is None:
url_auth = get_auth_from_url(self.url)
auth = url_auth if any(url_auth) else None
if auth:
if isinstance(auth, tuple) and len(auth) == 2:
# special-case basic HTTP auth
auth = HTTPBasicAuth(*auth)
# Allow auth to make its changes.
r = auth(self)
# Update self to reflect the auth changes.
self.__dict__.update(r.__dict__)
# Recompute Content-Length
self.prepare_content_length(self.body)
def prepare_cookies(self, cookies):
"""Prepares the given HTTP cookie data.
This function eventually generates a ``Cookie`` header from the
given cookies using cookielib. Due to cookielib's design, the header
will not be regenerated if it already exists, meaning this function
can only be called once for the life of the
:class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls
to ``prepare_cookies`` will have no actual effect, unless the "Cookie"
header is removed beforehand.
"""
if isinstance(cookies, cookielib.CookieJar):
self._cookies = cookies
else:
self._cookies = cookiejar_from_dict(cookies)
cookie_header = get_cookie_header(self._cookies, self)
if cookie_header is not None:
self.headers['Cookie'] = cookie_header
def prepare_hooks(self, hooks):
"""Prepares the given hooks."""
# hooks can be passed as None to the prepare method and to this
# method. To prevent iterating over None, simply use an empty list
# if hooks is False-y
hooks = hooks or []
for event in hooks:
self.register_hook(event, hooks[event])
class Response(object):
"""The :class:`Response <Response>` object, which contains a
server's response to an HTTP request.
"""
__attrs__ = [
'_content', 'status_code', 'headers', 'url', 'history',
'encoding', 'reason', 'cookies', 'elapsed', 'request'
]
def __init__(self):
self._content = False
self._content_consumed = False
self._next = None
#: Integer Code of responded HTTP Status, e.g. 404 or 200.
self.status_code = None
#: Case-insensitive Dictionary of Response Headers.
#: For example, ``headers['content-encoding']`` will return the
#: value of a ``'Content-Encoding'`` response header.
self.headers = CaseInsensitiveDict()
#: File-like object representation of response (for advanced usage).
#: Use of ``raw`` requires that ``stream=True`` be set on the request.
# This requirement does not apply for use internally to Requests.
self.raw = None
#: Final URL location of Response.
self.url = None
#: Encoding to decode with when accessing r.text.
self.encoding = None
#: A list of :class:`Response <Response>` objects from
#: the history of the Request. Any redirect responses will end
#: up here. The list is sorted from the oldest to the most recent request.
self.history = []
#: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK".
self.reason = None
#: A CookieJar of Cookies the server sent back.
self.cookies = cookiejar_from_dict({})
#: The amount of time elapsed between sending the request
#: and the arrival of the response (as a timedelta).
#: This property specifically measures the time taken between sending
#: the first byte of the request and finishing parsing the headers. It
#: is therefore unaffected by consuming the response content or the
#: value of the ``stream`` keyword argument.
self.elapsed = datetime.timedelta(0)
#: The :class:`PreparedRequest <PreparedRequest>` object to which this
#: is a response.
self.request = None
def __enter__(self):
return self
def __exit__(self, *args):
self.close()
def __getstate__(self):
# Consume everything; accessing the content attribute makes
# sure the content has been fully read.
if not self._content_consumed:
self.content
return dict(
(attr, getattr(self, attr, None))
for attr in self.__attrs__
)
def __setstate__(self, state):
for name, value in state.items():
setattr(self, name, value)
# pickled objects do not have .raw
setattr(self, '_content_consumed', True)
setattr(self, 'raw', None)
def __repr__(self):
return '<Response [%s]>' % (self.status_code)
def __bool__(self):
"""Returns True if :attr:`status_code` is less than 400.
This attribute checks if the status code of the response is between
400 and 600 to see if there was a client error or a server error. If
the status code, is between 200 and 400, this will return True. This
is **not** a check to see if the response code is ``200 OK``.
"""
return self.ok
def __nonzero__(self):
"""Returns True if :attr:`status_code` is less than 400.
This attribute checks if the status code of the response is between
400 and 600 to see if there was a client error or a server error. If
the status code, is between 200 and 400, this will return True. This
is **not** a check to see if the response code is ``200 OK``.
"""
return self.ok
def __iter__(self):
"""Allows you to use a response as an iterator."""
return self.iter_content(128)
@property
def ok(self):
"""Returns True if :attr:`status_code` is less than 400.
This attribute checks if the status code of the response is between
400 and 600 to see if there was a client error or a server error. If
the status code, is between 200 and 400, this will return True. This
is **not** a check to see if the response code is ``200 OK``.
"""
try:
self.raise_for_status()
except HTTPError:
return False
return True
@property
def is_redirect(self):
"""True if this Response is a well-formed HTTP redirect that could have
been processed automatically (by :meth:`Session.resolve_redirects`).
"""
return ('location' in self.headers and self.status_code in REDIRECT_STATI)
@property
def is_permanent_redirect(self):
"""True if this Response one of the permanent versions of redirect."""
return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect))
@property
def next(self):
"""Returns a PreparedRequest for the next request in a redirect chain, if there is one."""
return self._next
@property
def apparent_encoding(self):
"""The apparent encoding, provided by the chardet library."""
return chardet.detect(self.content)['encoding']
def iter_content(self, chunk_size=1, decode_unicode=False):
"""Iterates over the response data. When stream=True is set on the
request, this avoids reading the content at once into memory for
large responses. The chunk size is the number of bytes it should
read into memory. This is not necessarily the length of each item
returned as decoding can take place.
chunk_size must be of type int or None. A value of None will
function differently depending on the value of `stream`.
stream=True will read data as it arrives in whatever size the
chunks are received. If stream=False, data is returned as
a single chunk.
If decode_unicode is True, content will be decoded using the best
available encoding based on the response.
"""
def generate():
# Special case for urllib3.
if hasattr(self.raw, 'stream'):
try:
for chunk in self.raw.stream(chunk_size, decode_content=True):
yield chunk
except ProtocolError as e:
raise ChunkedEncodingError(e)
except DecodeError as e:
raise ContentDecodingError(e)
except ReadTimeoutError as e:
raise ConnectionError(e)
else:
# Standard file-like object.
while True:
chunk = self.raw.read(chunk_size)
if not chunk:
break
yield chunk
self._content_consumed = True
if self._content_consumed and isinstance(self._content, bool):
raise StreamConsumedError()
elif chunk_size is not None and not isinstance(chunk_size, int):
raise TypeError("chunk_size must be an int, it is instead a %s." % type(chunk_size))
# simulate reading small chunks of the content
reused_chunks = iter_slices(self._content, chunk_size)
stream_chunks = generate()
chunks = reused_chunks if self._content_consumed else stream_chunks
if decode_unicode:
chunks = stream_decode_response_unicode(chunks, self)
return chunks
def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None, delimiter=None):
"""Iterates over the response data, one line at a time. When
stream=True is set on the request, this avoids reading the
content at once into memory for large responses.
.. note:: This method is not reentrant safe.
"""
pending = None
for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):
if pending is not None:
chunk = pending + chunk
if delimiter:
lines = chunk.split(delimiter)
else:
lines = chunk.splitlines()
if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]:
pending = lines.pop()
else:
pending = None
for line in lines:
yield line
if pending is not None:
yield pending
@property
def content(self):
"""Content of the response, in bytes."""
if self._content is False:
# Read the contents.
if self._content_consumed:
raise RuntimeError(
'The content for this response was already consumed')
if self.status_code == 0 or self.raw is None:
self._content = None
else:
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
self._content_consumed = True
# don't need to release the connection; that's been handled by urllib3
# since we exhausted the data.
return self._content
@property
def text(self):
"""Content of the response, in unicode.
If Response.encoding is None, encoding will be guessed using
``chardet``.
The encoding of the response content is determined based solely on HTTP
headers, following RFC 2616 to the letter. If you can take advantage of
non-HTTP knowledge to make a better guess at the encoding, you should
set ``r.encoding`` appropriately before accessing this property.
"""
# Try charset from content-type
content = None
encoding = self.encoding
if not self.content:
return str('')
# Fallback to auto-detected encoding.
if self.encoding is None:
encoding = self.apparent_encoding
# Decode unicode from given encoding.
try:
content = str(self.content, encoding, errors='replace')
except (LookupError, TypeError):
# A LookupError is raised if the encoding was not found which could
# indicate a misspelling or similar mistake.
#
# A TypeError can be raised if encoding is None
#
# So we try blindly encoding.
content = str(self.content, errors='replace')
return content
def json(self, **kwargs):
r"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
:raises ValueError: If the response body does not contain valid json.
"""
if not self.encoding and self.content and len(self.content) > 3:
# No encoding set. JSON RFC 4627 section 3 states we should expect
# UTF-8, -16 or -32. Detect which one to use; If the detection or
# decoding fails, fall back to `self.text` (using chardet to make
# a best guess).
encoding = guess_json_utf(self.content)
if encoding is not None:
try:
return complexjson.loads(
self.content.decode(encoding), **kwargs
)
except UnicodeDecodeError:
# Wrong UTF codec detected; usually because it's not UTF-8
# but some other 8-bit codec. This is an RFC violation,
# and the server didn't bother to tell us what codec *was*
# used.
pass
return complexjson.loads(self.text, **kwargs)
@property
def links(self):
"""Returns the parsed header links of the response, if any."""
header = self.headers.get('link')
# l = MultiDict()
l = {}
if header:
links = parse_header_links(header)
for link in links:
key = link.get('rel') or link.get('url')
l[key] = link
return l
def raise_for_status(self):
"""Raises stored :class:`HTTPError`, if one occurred."""
http_error_msg = ''
if isinstance(self.reason, bytes):
# We attempt to decode utf-8 first because some servers
# choose to localize their reason strings. If the string
# isn't utf-8, we fall back to iso-8859-1 for all other
# encodings. (See PR #3538)
try:
reason = self.reason.decode('utf-8')
except UnicodeDecodeError:
reason = self.reason.decode('iso-8859-1')
else:
reason = self.reason
if 400 <= self.status_code < 500:
http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
elif 500 <= self.status_code < 600:
http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
if http_error_msg:
raise HTTPError(http_error_msg, response=self)
def close(self):
"""Releases the connection back to the pool. Once this method has been
called the underlying ``raw`` object must not be accessed again.
*Note: Should not normally need to be called explicitly.*
"""
if not self._content_consumed:
self.raw.close()
release_conn = getattr(self.raw, 'release_conn', None)
if release_conn is not None:
release_conn()

14
requests/packages.py Normal file
View File

@@ -0,0 +1,14 @@
import sys
# This code exists for backwards compatibility reasons.
# I don't like it either. Just look the other way. :)
for package in ('urllib3', 'idna', 'chardet'):
locals()[package] = __import__(package)
# This traversal is apparently necessary such that the identities are
# preserved (requests.packages.urllib3.* is urllib3.*)
for mod in list(sys.modules):
if mod == package or mod.startswith(package + '.'):
sys.modules['requests.packages.' + mod] = sys.modules[mod]
# Kinda cool, though, right?

View File

@@ -1 +0,0 @@
from . import poster

View File

@@ -1,32 +0,0 @@
# Copyright (c) 2010 Chris AtLee
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""poster module
Support for streaming HTTP uploads, and multipart/form-data encoding
```poster.version``` is a 3-tuple of integers representing the version number.
New releases of poster will always have a version number that compares greater
than an older version of poster.
New in version 0.6."""
from . import streaminghttp
from . import encode
version = (0, 8, 0) # Thanks JP!

View File

@@ -1,414 +0,0 @@
"""multipart/form-data encoding module
This module provides functions that faciliate encoding name/value pairs
as multipart/form-data suitable for a HTTP POST or PUT request.
multipart/form-data is the standard way to upload files over HTTP"""
__all__ = ['gen_boundary', 'encode_and_quote', 'MultipartParam',
'encode_string', 'encode_file_header', 'get_body_size', 'get_headers',
'multipart_encode']
try:
import uuid
def gen_boundary():
"""Returns a random string to use as the boundary for a message"""
return uuid.uuid4().hex
except ImportError:
import random, sha
def gen_boundary():
"""Returns a random string to use as the boundary for a message"""
bits = random.getrandbits(160)
return sha.new(str(bits)).hexdigest()
import urllib, re, os, mimetypes
try:
from email.header import Header
except ImportError:
# Python 2.4
from email.Header import Header
def encode_and_quote(data):
"""If ``data`` is unicode, return urllib.quote_plus(data.encode("utf-8"))
otherwise return urllib.quote_plus(data)"""
if data is None:
return None
if isinstance(data, unicode):
data = data.encode("utf-8")
return urllib.quote_plus(data)
def _strify(s):
"""If s is a unicode string, encode it to UTF-8 and return the results,
otherwise return str(s), or None if s is None"""
if s is None:
return None
if isinstance(s, unicode):
return s.encode("utf-8")
return str(s)
class MultipartParam(object):
"""Represents a single parameter in a multipart/form-data request
``name`` is the name of this parameter.
If ``value`` is set, it must be a string or unicode object to use as the
data for this parameter.
If ``filename`` is set, it is what to say that this parameter's filename
is. Note that this does not have to be the actual filename any local file.
If ``filetype`` is set, it is used as the Content-Type for this parameter.
If unset it defaults to "text/plain; charset=utf8"
If ``filesize`` is set, it specifies the length of the file ``fileobj``
If ``fileobj`` is set, it must be a file-like object that supports
.read().
Both ``value`` and ``fileobj`` must not be set, doing so will
raise a ValueError assertion.
If ``fileobj`` is set, and ``filesize`` is not specified, then
the file's size will be determined first by stat'ing ``fileobj``'s
file descriptor, and if that fails, by seeking to the end of the file,
recording the current position as the size, and then by seeking back to the
beginning of the file.
``cb`` is a callable which will be called from iter_encode with (self,
current, total), representing the current parameter, current amount
transferred, and the total size.
"""
def __init__(self, name, value=None, filename=None, filetype=None,
filesize=None, fileobj=None, cb=None):
self.name = Header(name).encode()
self.value = _strify(value)
if filename is None:
self.filename = None
else:
if isinstance(filename, unicode):
# Encode with XML entities
self.filename = filename.encode("ascii", "xmlcharrefreplace")
else:
self.filename = str(filename)
self.filename = self.filename.encode("string_escape").\
replace('"', '\\"')
self.filetype = _strify(filetype)
self.filesize = filesize
self.fileobj = fileobj
self.cb = cb
if self.value is not None and self.fileobj is not None:
raise ValueError("Only one of value or fileobj may be specified")
if fileobj is not None and filesize is None:
# Try and determine the file size
try:
self.filesize = os.fstat(fileobj.fileno()).st_size
except (OSError, AttributeError):
try:
fileobj.seek(0, 2)
self.filesize = fileobj.tell()
fileobj.seek(0)
except:
raise ValueError("Could not determine filesize")
def __cmp__(self, other):
attrs = ['name', 'value', 'filename', 'filetype', 'filesize', 'fileobj']
myattrs = [getattr(self, a) for a in attrs]
oattrs = [getattr(other, a) for a in attrs]
return cmp(myattrs, oattrs)
def reset(self):
if self.fileobj is not None:
self.fileobj.seek(0)
elif self.value is None:
raise ValueError("Don't know how to reset this parameter")
@classmethod
def from_file(cls, paramname, filename):
"""Returns a new MultipartParam object constructed from the local
file at ``filename``.
``filesize`` is determined by os.path.getsize(``filename``)
``filetype`` is determined by mimetypes.guess_type(``filename``)[0]
``filename`` is set to os.path.basename(``filename``)
"""
return cls(paramname, filename=os.path.basename(filename),
filetype=mimetypes.guess_type(filename)[0],
filesize=os.path.getsize(filename),
fileobj=open(filename, "rb"))
@classmethod
def from_params(cls, params):
"""Returns a list of MultipartParam objects from a sequence of
name, value pairs, MultipartParam instances,
or from a mapping of names to values
The values may be strings or file objects, or MultipartParam objects.
MultipartParam object names must match the given names in the
name,value pairs or mapping, if applicable."""
if hasattr(params, 'items'):
params = params.items()
retval = []
for item in params:
if isinstance(item, cls):
retval.append(item)
continue
name, value = item
if isinstance(value, cls):
assert value.name == name
retval.append(value)
continue
if hasattr(value, 'read'):
# Looks like a file object
filename = getattr(value, 'name', None)
if filename is not None:
filetype = mimetypes.guess_type(filename)[0]
else:
filetype = None
retval.append(cls(name=name, filename=filename,
filetype=filetype, fileobj=value))
else:
retval.append(cls(name, value))
return retval
def encode_hdr(self, boundary):
"""Returns the header of the encoding of this parameter"""
boundary = encode_and_quote(boundary)
headers = ["--%s" % boundary]
if self.filename:
disposition = 'form-data; name="%s"; filename="%s"' % (self.name,
self.filename)
else:
disposition = 'form-data; name="%s"' % self.name
headers.append("Content-Disposition: %s" % disposition)
if self.filetype:
filetype = self.filetype
else:
filetype = "text/plain; charset=utf-8"
headers.append("Content-Type: %s" % filetype)
headers.append("")
headers.append("")
return "\r\n".join(headers)
def encode(self, boundary):
"""Returns the string encoding of this parameter"""
if self.value is None:
value = self.fileobj.read()
else:
value = self.value
if re.search("^--%s$" % re.escape(boundary), value, re.M):
raise ValueError("boundary found in encoded string")
return "%s%s\r\n" % (self.encode_hdr(boundary), value)
def iter_encode(self, boundary, blocksize=4096):
"""Yields the encoding of this parameter
If self.fileobj is set, then blocks of ``blocksize`` bytes are read and
yielded."""
total = self.get_size(boundary)
current = 0
if self.value is not None:
block = self.encode(boundary)
current += len(block)
yield block
if self.cb:
self.cb(self, current, total)
else:
block = self.encode_hdr(boundary)
current += len(block)
yield block
if self.cb:
self.cb(self, current, total)
last_block = ""
encoded_boundary = "--%s" % encode_and_quote(boundary)
boundary_exp = re.compile("^%s$" % re.escape(encoded_boundary),
re.M)
while True:
block = self.fileobj.read(blocksize)
if not block:
current += 2
yield "\r\n"
if self.cb:
self.cb(self, current, total)
break
last_block += block
if boundary_exp.search(last_block):
raise ValueError("boundary found in file data")
last_block = last_block[-len(encoded_boundary)-2:]
current += len(block)
yield block
if self.cb:
self.cb(self, current, total)
def get_size(self, boundary):
"""Returns the size in bytes that this param will be when encoded
with the given boundary."""
if self.filesize is not None:
valuesize = self.filesize
else:
valuesize = len(self.value)
return len(self.encode_hdr(boundary)) + 2 + valuesize
def encode_string(boundary, name, value):
"""Returns ``name`` and ``value`` encoded as a multipart/form-data
variable. ``boundary`` is the boundary string used throughout
a single request to separate variables."""
return MultipartParam(name, value).encode(boundary)
def encode_file_header(boundary, paramname, filesize, filename=None,
filetype=None):
"""Returns the leading data for a multipart/form-data field that contains
file data.
``boundary`` is the boundary string used throughout a single request to
separate variables.
``paramname`` is the name of the variable in this request.
``filesize`` is the size of the file data.
``filename`` if specified is the filename to give to this field. This
field is only useful to the server for determining the original filename.
``filetype`` if specified is the MIME type of this file.
The actual file data should be sent after this header has been sent.
"""
return MultipartParam(paramname, filesize=filesize, filename=filename,
filetype=filetype).encode_hdr(boundary)
def get_body_size(params, boundary):
"""Returns the number of bytes that the multipart/form-data encoding
of ``params`` will be."""
size = sum(p.get_size(boundary) for p in MultipartParam.from_params(params))
return size + len(boundary) + 6
def get_headers(params, boundary):
"""Returns a dictionary with Content-Type and Content-Length headers
for the multipart/form-data encoding of ``params``."""
headers = {}
boundary = urllib.quote_plus(boundary)
headers['Content-Type'] = "multipart/form-data; boundary=%s" % boundary
headers['Content-Length'] = str(get_body_size(params, boundary))
return headers
class multipart_yielder:
def __init__(self, params, boundary, cb):
self.params = params
self.boundary = boundary
self.cb = cb
self.i = 0
self.p = None
self.param_iter = None
self.current = 0
self.total = get_body_size(params, boundary)
def __iter__(self):
return self
def next(self):
"""generator function to yield multipart/form-data representation
of parameters"""
if self.param_iter is not None:
try:
block = self.param_iter.next()
self.current += len(block)
if self.cb:
self.cb(self.p, self.current, self.total)
return block
except StopIteration:
self.p = None
self.param_iter = None
if self.i is None:
raise StopIteration
elif self.i >= len(self.params):
self.param_iter = None
self.p = None
self.i = None
block = "--%s--\r\n" % self.boundary
self.current += len(block)
if self.cb:
self.cb(self.p, self.current, self.total)
return block
self.p = self.params[self.i]
self.param_iter = self.p.iter_encode(self.boundary)
self.i += 1
return self.next()
def reset(self):
self.i = 0
self.current = 0
for param in self.params:
param.reset()
def multipart_encode(params, boundary=None, cb=None):
"""Encode ``params`` as multipart/form-data.
``params`` should be a sequence of (name, value) pairs or MultipartParam
objects, or a mapping of names to values.
Values are either strings parameter values, or file-like objects to use as
the parameter value. The file-like objects must support .read() and either
.fileno() or both .seek() and .tell().
If ``boundary`` is set, then it as used as the MIME boundary. Otherwise
a randomly generated boundary will be used. In either case, if the
boundary string appears in the parameter values a ValueError will be
raised.
If ``cb`` is set, it should be a callback which will get called as blocks
of data are encoded. It will be called with (param, current, total),
indicating the current parameter being encoded, the current amount encoded,
and the total amount to encode.
Returns a tuple of `datagen`, `headers`, where `datagen` is a
generator that will yield blocks of data that make up the encoded
parameters, and `headers` is a dictionary with the assoicated
Content-Type and Content-Length headers.
Examples:
>>> datagen, headers = multipart_encode( [("key", "value1"), ("key", "value2")] )
>>> s = "".join(datagen)
>>> assert "value2" in s and "value1" in s
>>> p = MultipartParam("key", "value2")
>>> datagen, headers = multipart_encode( [("key", "value1"), p] )
>>> s = "".join(datagen)
>>> assert "value2" in s and "value1" in s
>>> datagen, headers = multipart_encode( {"key": "value1"} )
>>> s = "".join(datagen)
>>> assert "value2" not in s and "value1" in s
"""
if boundary is None:
boundary = gen_boundary()
else:
boundary = urllib.quote_plus(boundary)
headers = get_headers(params, boundary)
params = MultipartParam.from_params(params)
return multipart_yielder(params, boundary, cb), headers

View File

@@ -1,197 +0,0 @@
"""Streaming HTTP uploads module.
This module extends the standard httplib and urllib2 objects so that
iterable objects can be used in the body of HTTP requests.
In most cases all one should have to do is call :func:`register_openers()`
to register the new streaming http handlers which will take priority over
the default handlers, and then you can use iterable objects in the body
of HTTP requests.
**N.B.** You must specify a Content-Length header if using an iterable object
since there is no way to determine in advance the total size that will be
yielded, and there is no way to reset an interator.
Example usage:
>>> from StringIO import StringIO
>>> import urllib2, poster.streaminghttp
>>> opener = poster.streaminghttp.register_openers()
>>> s = "Test file data"
>>> f = StringIO(s)
>>> req = urllib2.Request("http://localhost:5000", f,
... {'Content-Length': str(len(s))})
"""
import httplib, urllib2, socket
from httplib import NotConnected
__all__ = ['StreamingHTTPConnection', 'StreamingHTTPRedirectHandler',
'StreamingHTTPHandler', 'register_openers']
if hasattr(httplib, 'HTTPS'):
__all__.extend(['StreamingHTTPSHandler', 'StreamingHTTPSConnection'])
class _StreamingHTTPMixin:
"""Mixin class for HTTP and HTTPS connections that implements a streaming
send method."""
def send(self, value):
"""Send ``value`` to the server.
``value`` can be a string object, a file-like object that supports
a .read() method, or an iterable object that supports a .next()
method.
"""
# Based on python 2.6's httplib.HTTPConnection.send()
if self.sock is None:
if self.auto_open:
self.connect()
else:
raise NotConnected()
# send the data to the server. if we get a broken pipe, then close
# the socket. we want to reconnect when somebody tries to send again.
#
# NOTE: we DO propagate the error, though, because we cannot simply
# ignore the error... the caller will know if they can retry.
if self.debuglevel > 0:
print "send:", repr(value)
try:
blocksize = 8192
if hasattr(value, 'read') :
if hasattr(value, 'seek'):
value.seek(0)
if self.debuglevel > 0:
print "sendIng a read()able"
data = value.read(blocksize)
while data:
self.sock.sendall(data)
data = value.read(blocksize)
elif hasattr(value, 'next'):
if hasattr(value, 'reset'):
value.reset()
if self.debuglevel > 0:
print "sendIng an iterable"
for data in value:
self.sock.sendall(data)
else:
self.sock.sendall(value)
except socket.error, v:
if v[0] == 32: # Broken pipe
self.close()
raise
class StreamingHTTPConnection(_StreamingHTTPMixin, httplib.HTTPConnection):
"""Subclass of `httplib.HTTPConnection` that overrides the `send()` method
to support iterable body objects"""
class StreamingHTTPRedirectHandler(urllib2.HTTPRedirectHandler):
"""Subclass of `urllib2.HTTPRedirectHandler` that overrides the
`redirect_request` method to properly handle redirected POST requests
This class is required because python 2.5's HTTPRedirectHandler does
not remove the Content-Type or Content-Length headers when requesting
the new resource, but the body of the original request is not preserved.
"""
handler_order = urllib2.HTTPRedirectHandler.handler_order - 1
# From python2.6 urllib2's HTTPRedirectHandler
def redirect_request(self, req, fp, code, msg, headers, newurl):
"""Return a Request or None in response to a redirect.
This is called by the http_error_30x methods when a
redirection response is received. If a redirection should
take place, return a new Request to allow http_error_30x to
perform the redirect. Otherwise, raise HTTPError if no-one
else should try to handle this url. Return None if you can't
but another Handler might.
"""
m = req.get_method()
if (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
or code in (301, 302, 303) and m == "POST"):
# Strictly (according to RFC 2616), 301 or 302 in response
# to a POST MUST NOT cause a redirection without confirmation
# from the user (of urllib2, in this case). In practice,
# essentially all clients do redirect in this case, so we
# do the same.
# be conciliant with URIs containing a space
newurl = newurl.replace(' ', '%20')
newheaders = dict((k, v) for k, v in req.headers.items()
if k.lower() not in (
"content-length", "content-type")
)
return urllib2.Request(newurl,
headers=newheaders,
origin_req_host=req.get_origin_req_host(),
unverifiable=True)
else:
raise urllib2.HTTPError(req.get_full_url(), code, msg, headers, fp)
class StreamingHTTPHandler(urllib2.HTTPHandler):
"""Subclass of `urllib2.HTTPHandler` that uses
StreamingHTTPConnection as its http connection class."""
handler_order = urllib2.HTTPHandler.handler_order - 1
def http_open(self, req):
"""Open a StreamingHTTPConnection for the given request"""
return self.do_open(StreamingHTTPConnection, req)
def http_request(self, req):
"""Handle a HTTP request. Make sure that Content-Length is specified
if we're using an interable value"""
# Make sure that if we're using an iterable object as the request
# body, that we've also specified Content-Length
if req.has_data():
data = req.get_data()
if hasattr(data, 'read') or hasattr(data, 'next'):
if not req.has_header('Content-length'):
raise ValueError(
"No Content-Length specified for iterable body")
return urllib2.HTTPHandler.do_request_(self, req)
if hasattr(httplib, 'HTTPS'):
class StreamingHTTPSConnection(_StreamingHTTPMixin,
httplib.HTTPSConnection):
"""Subclass of `httplib.HTTSConnection` that overrides the `send()`
method to support iterable body objects"""
class StreamingHTTPSHandler(urllib2.HTTPSHandler):
"""Subclass of `urllib2.HTTPSHandler` that uses
StreamingHTTPSConnection as its http connection class."""
handler_order = urllib2.HTTPSHandler.handler_order - 1
def https_open(self, req):
return self.do_open(StreamingHTTPSConnection, req)
def https_request(self, req):
# Make sure that if we're using an iterable object as the request
# body, that we've also specified Content-Length
if req.has_data():
data = req.get_data()
if hasattr(data, 'read') or hasattr(data, 'next'):
if not req.has_header('Content-length'):
raise ValueError(
"No Content-Length specified for iterable body")
return urllib2.HTTPSHandler.do_request_(self, req)
def register_openers():
"""Register the streaming http handlers in the global urllib2 default
opener object.
Returns the created OpenerDirector object."""
handlers = [StreamingHTTPHandler, StreamingHTTPRedirectHandler]
if hasattr(httplib, "HTTPS"):
handlers.append(StreamingHTTPSHandler)
opener = urllib2.build_opener(*handlers)
urllib2.install_opener(opener)
return opener

737
requests/sessions.py Normal file
View File

@@ -0,0 +1,737 @@
# -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
import platform
import time
from collections import Mapping
from datetime import timedelta
from .auth import _basic_auth_str
from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse
from .cookies import (
cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar, merge_cookies)
from .models import Request, PreparedRequest, DEFAULT_REDIRECT_LIMIT
from .hooks import default_hooks, dispatch_hook
from ._internal_utils import to_native_string
from .utils import to_key_val_list, default_headers
from .exceptions import (
TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError)
from .structures import CaseInsensitiveDict
from .adapters import HTTPAdapter
from .utils import (
requote_uri, get_environ_proxies, get_netrc_auth, should_bypass_proxies,
get_auth_from_url, rewind_body
)
from .status_codes import codes
# formerly defined here, reexposed here for backward compatibility
from .models import REDIRECT_STATI
# Preferred clock, based on which one is more accurate on a given system.
if platform.system() == 'Windows':
try: # Python 3.3+
preferred_clock = time.perf_counter
except AttributeError: # Earlier than Python 3.
preferred_clock = time.clock
else:
preferred_clock = time.time
def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
"""Determines appropriate setting for a given request, taking into account
the explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
"""
if session_setting is None:
return request_setting
if request_setting is None:
return session_setting
# Bypass if not a dictionary (e.g. verify)
if not (
isinstance(session_setting, Mapping) and
isinstance(request_setting, Mapping)
):
return request_setting
merged_setting = dict_class(to_key_val_list(session_setting))
merged_setting.update(to_key_val_list(request_setting))
# Remove keys that are set to None. Extract keys first to avoid altering
# the dictionary during iteration.
none_keys = [k for (k, v) in merged_setting.items() if v is None]
for key in none_keys:
del merged_setting[key]
return merged_setting
def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict):
"""Properly merges both requests and session hooks.
This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.
"""
if session_hooks is None or session_hooks.get('response') == []:
return request_hooks
if request_hooks is None or request_hooks.get('response') == []:
return session_hooks
return merge_setting(request_hooks, session_hooks, dict_class)
class SessionRedirectMixin(object):
def get_redirect_target(self, resp):
"""Receives a Response. Returns a redirect URI or ``None``"""
# Due to the nature of how requests processes redirects this method will
# be called at least once upon the original response and at least twice
# on each subsequent redirect response (if any).
# If a custom mixin is used to handle this logic, it may be advantageous
# to cache the redirect location onto the response object as a private
# attribute.
if resp.is_redirect:
location = resp.headers['location']
# Currently the underlying http module on py3 decode headers
# in latin1, but empirical evidence suggests that latin1 is very
# rarely used with non-ASCII characters in HTTP headers.
# It is more likely to get UTF8 header rather than latin1.
# This causes incorrect handling of UTF8 encoded location headers.
# To solve this, we re-encode the location in latin1.
if is_py3:
location = location.encode('latin1')
return to_native_string(location, 'utf8')
return None
def resolve_redirects(self, resp, req, stream=False, timeout=None,
verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs):
"""Receives a Response. Returns a generator of Responses or Requests."""
hist = [] # keep track of history
url = self.get_redirect_target(resp)
while url:
prepared_request = req.copy()
# Update history and keep track of redirects.
# resp.history must ignore the original request in this loop
hist.append(resp)
resp.history = hist[1:]
try:
resp.content # Consume socket so it can be released
except (ChunkedEncodingError, ContentDecodingError, RuntimeError):
resp.raw.read(decode_content=False)
if len(resp.history) >= self.max_redirects:
raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects, response=resp)
# Release the connection back into the pool.
resp.close()
# Handle redirection without scheme (see: RFC 1808 Section 4)
if url.startswith('//'):
parsed_rurl = urlparse(resp.url)
url = '%s:%s' % (to_native_string(parsed_rurl.scheme), url)
# The scheme should be lower case...
parsed = urlparse(url)
url = parsed.geturl()
# Facilitate relative 'location' headers, as allowed by RFC 7231.
# (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
# Compliant with RFC3986, we percent encode the url.
if not parsed.netloc:
url = urljoin(resp.url, requote_uri(url))
else:
url = requote_uri(url)
prepared_request.url = to_native_string(url)
self.rebuild_method(prepared_request, resp)
# https://github.com/requests/requests/issues/1084
if resp.status_code not in (codes.temporary_redirect, codes.permanent_redirect):
# https://github.com/requests/requests/issues/3490
purged_headers = ('Content-Length', 'Content-Type', 'Transfer-Encoding')
for header in purged_headers:
prepared_request.headers.pop(header, None)
prepared_request.body = None
headers = prepared_request.headers
try:
del headers['Cookie']
except KeyError:
pass
# Extract any cookies sent on the response to the cookiejar
# in the new request. Because we've mutated our copied prepared
# request, use the old one that we haven't yet touched.
extract_cookies_to_jar(prepared_request._cookies, req, resp.raw)
merge_cookies(prepared_request._cookies, self.cookies)
prepared_request.prepare_cookies(prepared_request._cookies)
# Rebuild auth and proxy information.
proxies = self.rebuild_proxies(prepared_request, proxies)
self.rebuild_auth(prepared_request, resp)
# A failed tell() sets `_body_position` to `object()`. This non-None
# value ensures `rewindable` will be True, allowing us to raise an
# UnrewindableBodyError, instead of hanging the connection.
rewindable = (
prepared_request._body_position is not None and
('Content-Length' in headers or 'Transfer-Encoding' in headers)
)
# Attempt to rewind consumed file-like object.
if rewindable:
rewind_body(prepared_request)
# Override the original request.
req = prepared_request
if yield_requests:
yield req
else:
resp = self.send(
req,
stream=stream,
timeout=timeout,
verify=verify,
cert=cert,
proxies=proxies,
allow_redirects=False,
**adapter_kwargs
)
extract_cookies_to_jar(self.cookies, prepared_request, resp.raw)
# extract redirect url, if any, for the next loop
url = self.get_redirect_target(resp)
yield resp
def rebuild_auth(self, prepared_request, response):
"""When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
"""
headers = prepared_request.headers
url = prepared_request.url
if 'Authorization' in headers:
# If we get redirected to a new host, we should strip out any
# authentication headers.
original_parsed = urlparse(response.request.url)
redirect_parsed = urlparse(url)
if (original_parsed.hostname != redirect_parsed.hostname):
del headers['Authorization']
# .netrc might have more auth for us on our new host.
new_auth = get_netrc_auth(url) if self.trust_env else None
if new_auth is not None:
prepared_request.prepare_auth(new_auth)
return
def rebuild_proxies(self, prepared_request, proxies):
"""This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in case they were stripped by a previous
redirect).
This method also replaces the Proxy-Authorization header where
necessary.
:rtype: dict
"""
proxies = proxies if proxies is not None else {}
headers = prepared_request.headers
url = prepared_request.url
scheme = urlparse(url).scheme
new_proxies = proxies.copy()
no_proxy = proxies.get('no_proxy')
bypass_proxy = should_bypass_proxies(url, no_proxy=no_proxy)
if self.trust_env and not bypass_proxy:
environ_proxies = get_environ_proxies(url, no_proxy=no_proxy)
proxy = environ_proxies.get(scheme, environ_proxies.get('all'))
if proxy:
new_proxies.setdefault(scheme, proxy)
if 'Proxy-Authorization' in headers:
del headers['Proxy-Authorization']
try:
username, password = get_auth_from_url(new_proxies[scheme])
except KeyError:
username, password = None, None
if username and password:
headers['Proxy-Authorization'] = _basic_auth_str(username, password)
return new_proxies
def rebuild_method(self, prepared_request, response):
"""When being redirected we may want to change the method of the request
based on certain specs or browser behavior.
"""
method = prepared_request.method
# http://tools.ietf.org/html/rfc7231#section-6.4.4
if response.status_code == codes.see_other and method != 'HEAD':
method = 'GET'
# Do what the browsers do, despite standards...
# First, turn 302s into GETs.
if response.status_code == codes.found and method != 'HEAD':
method = 'GET'
# Second, if a POST is responded to with a 301, turn it into a GET.
# This bizarre behaviour is explained in Issue 1704.
if response.status_code == codes.moved and method == 'POST':
method = 'GET'
prepared_request.method = method
class Session(SessionRedirectMixin):
"""A Requests session.
Provides cookie persistence, connection-pooling, and configuration.
Basic Usage::
>>> import requests
>>> s = requests.Session()
>>> s.get('http://httpbin.org/get')
<Response [200]>
Or as a context manager::
>>> with requests.Session() as s:
>>> s.get('http://httpbin.org/get')
<Response [200]>
"""
__attrs__ = [
'headers', 'cookies', 'auth', 'proxies', 'hooks', 'params', 'verify',
'cert', 'prefetch', 'adapters', 'stream', 'trust_env',
'max_redirects',
]
def __init__(self):
#: A case-insensitive dictionary of headers to be sent on each
#: :class:`Request <Request>` sent from this
#: :class:`Session <Session>`.
self.headers = default_headers()
#: Default Authentication tuple or object to attach to
#: :class:`Request <Request>`.
self.auth = None
#: Dictionary mapping protocol or protocol and host to the URL of the proxy
#: (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to
#: be used on each :class:`Request <Request>`.
self.proxies = {}
#: Event-handling hooks.
self.hooks = default_hooks()
#: Dictionary of querystring data to attach to each
#: :class:`Request <Request>`. The dictionary values may be lists for
#: representing multivalued query parameters.
self.params = {}
#: Stream response content default.
self.stream = False
#: SSL Verification default.
self.verify = True
#: SSL client certificate default, if String, path to ssl client
#: cert file (.pem). If Tuple, ('cert', 'key') pair.
self.cert = None
#: Maximum number of redirects allowed. If the request exceeds this
#: limit, a :class:`TooManyRedirects` exception is raised.
#: This defaults to requests.models.DEFAULT_REDIRECT_LIMIT, which is
#: 30.
self.max_redirects = DEFAULT_REDIRECT_LIMIT
#: Trust environment settings for proxy configuration, default
#: authentication and similar.
self.trust_env = True
#: A CookieJar containing all currently outstanding cookies set on this
#: session. By default it is a
#: :class:`RequestsCookieJar <requests.cookies.RequestsCookieJar>`, but
#: may be any other ``cookielib.CookieJar`` compatible object.
self.cookies = cookiejar_from_dict({})
# Default connection adapters.
self.adapters = OrderedDict()
self.mount('https://', HTTPAdapter())
self.mount('http://', HTTPAdapter())
def __enter__(self):
return self
def __exit__(self, *args):
self.close()
def prepare_request(self, request):
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for
transmission and returns it. The :class:`PreparedRequest` has settings
merged from the :class:`Request <Request>` instance and those of the
:class:`Session`.
:param request: :class:`Request` instance to prepare with this
session's settings.
:rtype: requests.PreparedRequest
"""
cookies = request.cookies or {}
# Bootstrap CookieJar.
if not isinstance(cookies, cookielib.CookieJar):
cookies = cookiejar_from_dict(cookies)
# Merge with session cookies
merged_cookies = merge_cookies(
merge_cookies(RequestsCookieJar(), self.cookies), cookies)
# Set environment's basic authentication if not explicitly set.
auth = request.auth
if self.trust_env and not auth and not self.auth:
auth = get_netrc_auth(request.url)
p = PreparedRequest()
p.prepare(
method=request.method.upper(),
url=request.url,
files=request.files,
data=request.data,
json=request.json,
headers=merge_setting(request.headers, self.headers, dict_class=CaseInsensitiveDict),
params=merge_setting(request.params, self.params),
auth=merge_setting(auth, self.auth),
cookies=merged_cookies,
hooks=merge_hooks(request.hooks, self.hooks),
)
return p
def request(self, method, url,
params=None, data=None, headers=None, cookies=None, files=None,
auth=None, timeout=None, allow_redirects=True, proxies=None,
hooks=None, stream=None, verify=None, cert=None, json=None):
"""Constructs a :class:`Request <Request>`, prepares it and sends it.
Returns :class:`Response <Response>` object.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the query
string for the :class:`Request`.
:param data: (optional) Dictionary, bytes, or file-like object to send
in the body of the :class:`Request`.
:param json: (optional) json to send in the body of the
:class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the
:class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the
:class:`Request`.
:param files: (optional) Dictionary of ``'filename': file-like-objects``
for multipart encoding upload.
:param auth: (optional) Auth tuple or callable to enable
Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) How long to wait for the server to send
data before giving up, as a float, or a :ref:`(connect timeout,
read timeout) <timeouts>` tuple.
:type timeout: float or tuple
:param allow_redirects: (optional) Set to True by default.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol or protocol and
hostname to the URL of the proxy.
:param stream: (optional) whether to immediately download the response
content. Defaults to ``False``.
:param verify: (optional) Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use. Defaults to ``True``.
:param cert: (optional) if String, path to ssl client cert file (.pem).
If Tuple, ('cert', 'key') pair.
:rtype: requests.Response
"""
# Create the Request.
req = Request(
method=method.upper(),
url=url,
headers=headers,
files=files,
data=data or {},
json=json,
params=params or {},
auth=auth,
cookies=cookies,
hooks=hooks,
)
prep = self.prepare_request(req)
proxies = proxies or {}
settings = self.merge_environment_settings(
prep.url, proxies, stream, verify, cert
)
# Send the request.
send_kwargs = {
'timeout': timeout,
'allow_redirects': allow_redirects,
}
send_kwargs.update(settings)
resp = self.send(prep, **send_kwargs)
return resp
def get(self, url, **kwargs):
r"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', True)
return self.request('GET', url, **kwargs)
def options(self, url, **kwargs):
r"""Sends a OPTIONS request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', True)
return self.request('OPTIONS', url, **kwargs)
def head(self, url, **kwargs):
r"""Sends a HEAD request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', False)
return self.request('HEAD', url, **kwargs)
def post(self, url, data=None, json=None, **kwargs):
r"""Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
return self.request('POST', url, data=data, json=json, **kwargs)
def put(self, url, data=None, **kwargs):
r"""Sends a PUT request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
return self.request('PUT', url, data=data, **kwargs)
def patch(self, url, data=None, **kwargs):
r"""Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
return self.request('PATCH', url, data=data, **kwargs)
def delete(self, url, **kwargs):
r"""Sends a DELETE request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
return self.request('DELETE', url, **kwargs)
def send(self, request, **kwargs):
"""Send a given PreparedRequest.
:rtype: requests.Response
"""
# Set defaults that the hooks can utilize to ensure they always have
# the correct parameters to reproduce the previous request.
kwargs.setdefault('stream', self.stream)
kwargs.setdefault('verify', self.verify)
kwargs.setdefault('cert', self.cert)
kwargs.setdefault('proxies', self.proxies)
# It's possible that users might accidentally send a Request object.
# Guard against that specific failure case.
if isinstance(request, Request):
raise ValueError('You can only send PreparedRequests.')
# Set up variables needed for resolve_redirects and dispatching of hooks
allow_redirects = kwargs.pop('allow_redirects', True)
stream = kwargs.get('stream')
hooks = request.hooks
# Get the appropriate adapter to use
adapter = self.get_adapter(url=request.url)
# Start time (approximately) of the request
start = preferred_clock()
# Send the request
r = adapter.send(request, **kwargs)
# Total elapsed time of the request (approximately)
elapsed = preferred_clock() - start
r.elapsed = timedelta(seconds=elapsed)
# Response manipulation hooks
r = dispatch_hook('response', hooks, r, **kwargs)
# Persist cookies
if r.history:
# If the hooks create history then we want those cookies too
for resp in r.history:
extract_cookies_to_jar(self.cookies, resp.request, resp.raw)
extract_cookies_to_jar(self.cookies, request, r.raw)
# Redirect resolving generator.
gen = self.resolve_redirects(r, request, **kwargs)
# Resolve redirects if allowed.
history = [resp for resp in gen] if allow_redirects else []
# Shuffle things around if there's history.
if history:
# Insert the first (original) request at the start
history.insert(0, r)
# Get the last request made
r = history.pop()
r.history = history
# If redirects aren't being followed, store the response on the Request for Response.next().
if not allow_redirects:
try:
r._next = next(self.resolve_redirects(r, request, yield_requests=True, **kwargs))
except StopIteration:
pass
if not stream:
r.content
return r
def merge_environment_settings(self, url, proxies, stream, verify, cert):
"""
Check the environment and merge it with some settings.
:rtype: dict
"""
# Gather clues from the surrounding environment.
if self.trust_env:
# Set environment's proxies.
no_proxy = proxies.get('no_proxy') if proxies is not None else None
env_proxies = get_environ_proxies(url, no_proxy=no_proxy)
for (k, v) in env_proxies.items():
proxies.setdefault(k, v)
# Look for requests environment configuration and be compatible
# with cURL.
if verify is True or verify is None:
verify = (os.environ.get('REQUESTS_CA_BUNDLE') or
os.environ.get('CURL_CA_BUNDLE'))
# Merge all the kwargs.
proxies = merge_setting(proxies, self.proxies)
stream = merge_setting(stream, self.stream)
verify = merge_setting(verify, self.verify)
cert = merge_setting(cert, self.cert)
return {'verify': verify, 'proxies': proxies, 'stream': stream,
'cert': cert}
def get_adapter(self, url):
"""
Returns the appropriate connection adapter for the given URL.
:rtype: requests.adapters.BaseAdapter
"""
for (prefix, adapter) in self.adapters.items():
if url.lower().startswith(prefix):
return adapter
# Nothing matches :-/
raise InvalidSchema("No connection adapters were found for '%s'" % url)
def close(self):
"""Closes all adapters and as such the session"""
for v in self.adapters.values():
v.close()
def mount(self, prefix, adapter):
"""Registers a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length.
"""
self.adapters[prefix] = adapter
keys_to_move = [k for k in self.adapters if len(k) < len(prefix)]
for key in keys_to_move:
self.adapters[key] = self.adapters.pop(key)
def __getstate__(self):
state = dict((attr, getattr(self, attr, None)) for attr in self.__attrs__)
return state
def __setstate__(self, state):
for attr, value in state.items():
setattr(self, attr, value)
def session():
"""
Returns a :class:`Session` for context-management.
:rtype: Session
"""
return Session()

91
requests/status_codes.py Normal file
View File

@@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
from .structures import LookupDict
_codes = {
# Informational.
100: ('continue',),
101: ('switching_protocols',),
102: ('processing',),
103: ('checkpoint',),
122: ('uri_too_long', 'request_uri_too_long'),
200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', ''),
201: ('created',),
202: ('accepted',),
203: ('non_authoritative_info', 'non_authoritative_information'),
204: ('no_content',),
205: ('reset_content', 'reset'),
206: ('partial_content', 'partial'),
207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'),
208: ('already_reported',),
226: ('im_used',),
# Redirection.
300: ('multiple_choices',),
301: ('moved_permanently', 'moved', '\\o-'),
302: ('found',),
303: ('see_other', 'other'),
304: ('not_modified',),
305: ('use_proxy',),
306: ('switch_proxy',),
307: ('temporary_redirect', 'temporary_moved', 'temporary'),
308: ('permanent_redirect',
'resume_incomplete', 'resume',), # These 2 to be removed in 3.0
# Client Error.
400: ('bad_request', 'bad'),
401: ('unauthorized',),
402: ('payment_required', 'payment'),
403: ('forbidden',),
404: ('not_found', '-o-'),
405: ('method_not_allowed', 'not_allowed'),
406: ('not_acceptable',),
407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'),
408: ('request_timeout', 'timeout'),
409: ('conflict',),
410: ('gone',),
411: ('length_required',),
412: ('precondition_failed', 'precondition'),
413: ('request_entity_too_large',),
414: ('request_uri_too_large',),
415: ('unsupported_media_type', 'unsupported_media', 'media_type'),
416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'),
417: ('expectation_failed',),
418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'),
421: ('misdirected_request',),
422: ('unprocessable_entity', 'unprocessable'),
423: ('locked',),
424: ('failed_dependency', 'dependency'),
425: ('unordered_collection', 'unordered'),
426: ('upgrade_required', 'upgrade'),
428: ('precondition_required', 'precondition'),
429: ('too_many_requests', 'too_many'),
431: ('header_fields_too_large', 'fields_too_large'),
444: ('no_response', 'none'),
449: ('retry_with', 'retry'),
450: ('blocked_by_windows_parental_controls', 'parental_controls'),
451: ('unavailable_for_legal_reasons', 'legal_reasons'),
499: ('client_closed_request',),
# Server Error.
500: ('internal_server_error', 'server_error', '/o\\', ''),
501: ('not_implemented',),
502: ('bad_gateway',),
503: ('service_unavailable', 'unavailable'),
504: ('gateway_timeout',),
505: ('http_version_not_supported', 'http_version'),
506: ('variant_also_negotiates',),
507: ('insufficient_storage',),
509: ('bandwidth_limit_exceeded', 'bandwidth'),
510: ('not_extended',),
511: ('network_authentication_required', 'network_auth', 'network_authentication'),
}
codes = LookupDict(name='status_codes')
for code, titles in _codes.items():
for title in titles:
setattr(codes, title, code)
if not title.startswith(('\\', '/')):
setattr(codes, title.upper(), code)

105
requests/structures.py Normal file
View File

@@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
"""
requests.structures
~~~~~~~~~~~~~~~~~~~
Data structures that power Requests.
"""
import collections
from .compat import OrderedDict
class CaseInsensitiveDict(collections.MutableMapping):
"""A case-insensitive ``dict``-like object.
Implements all methods and operations of
``collections.MutableMapping`` as well as dict's ``copy``. Also
provides ``lower_items``.
All keys are expected to be strings. The structure remembers the
case of the last key to be set, and ``iter(instance)``,
``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()``
will contain case-sensitive keys. However, querying and contains
testing is case insensitive::
cid = CaseInsensitiveDict()
cid['Accept'] = 'application/json'
cid['aCCEPT'] == 'application/json' # True
list(cid) == ['Accept'] # True
For example, ``headers['content-encoding']`` will return the
value of a ``'Content-Encoding'`` response header, regardless
of how the header name was originally stored.
If the constructor, ``.update``, or equality comparison
operations are given keys that have equal ``.lower()``s, the
behavior is undefined.
"""
def __init__(self, data=None, **kwargs):
self._store = OrderedDict()
if data is None:
data = {}
self.update(data, **kwargs)
def __setitem__(self, key, value):
# Use the lowercased key for lookups, but store the actual
# key alongside the value.
self._store[key.lower()] = (key, value)
def __getitem__(self, key):
return self._store[key.lower()][1]
def __delitem__(self, key):
del self._store[key.lower()]
def __iter__(self):
return (casedkey for casedkey, mappedvalue in self._store.values())
def __len__(self):
return len(self._store)
def lower_items(self):
"""Like iteritems(), but with all lowercase keys."""
return (
(lowerkey, keyval[1])
for (lowerkey, keyval)
in self._store.items()
)
def __eq__(self, other):
if isinstance(other, collections.Mapping):
other = CaseInsensitiveDict(other)
else:
return NotImplemented
# Compare insensitively
return dict(self.lower_items()) == dict(other.lower_items())
# Copy is required
def copy(self):
return CaseInsensitiveDict(self._store.values())
def __repr__(self):
return str(dict(self.items()))
class LookupDict(dict):
"""Dictionary lookup object."""
def __init__(self, name=None):
self.name = name
super(LookupDict, self).__init__()
def __repr__(self):
return '<lookup \'%s\'>' % (self.name)
def __getitem__(self, key):
# We allow fall-through here, so values default to None
return self.__dict__.get(key, None)
def get(self, key, default=None):
return self.__dict__.get(key, default)

904
requests/utils.py Normal file
View File

@@ -0,0 +1,904 @@
# -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import collections
import contextlib
import io
import os
import platform
import re
import socket
import struct
import warnings
from .__version__ import __version__
from . import certs
# to_native_string is unused here, but imported here for backwards compatibility
from ._internal_utils import to_native_string
from .compat import parse_http_list as _parse_list_header
from .compat import (
quote, urlparse, bytes, str, OrderedDict, unquote, getproxies,
proxy_bypass, urlunparse, basestring, integer_types, is_py3,
proxy_bypass_environment, getproxies_environment)
from .cookies import cookiejar_from_dict
from .structures import CaseInsensitiveDict
from .exceptions import (
InvalidURL, InvalidHeader, FileModeWarning, UnrewindableBodyError)
NETRC_FILES = ('.netrc', '_netrc')
DEFAULT_CA_BUNDLE_PATH = certs.where()
if platform.system() == 'Windows':
# provide a proxy_bypass version on Windows without DNS lookups
def proxy_bypass_registry(host):
if is_py3:
import winreg
else:
import _winreg as winreg
try:
internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
proxyEnable = winreg.QueryValueEx(internetSettings,
'ProxyEnable')[0]
proxyOverride = winreg.QueryValueEx(internetSettings,
'ProxyOverride')[0]
except OSError:
return False
if not proxyEnable or not proxyOverride:
return False
# make a check value list from the registry entry: replace the
# '<local>' string by the localhost entry and the corresponding
# canonical entry.
proxyOverride = proxyOverride.split(';')
# now check if we match one of the registry values.
for test in proxyOverride:
if test == '<local>':
if '.' not in host:
return True
test = test.replace(".", r"\.") # mask dots
test = test.replace("*", r".*") # change glob sequence
test = test.replace("?", r".") # change glob char
if re.match(test, host, re.I):
return True
return False
def proxy_bypass(host): # noqa
"""Return True, if the host should be bypassed.
Checks proxy settings gathered from the environment, if specified,
or the registry.
"""
if getproxies_environment():
return proxy_bypass_environment(host)
else:
return proxy_bypass_registry(host)
def dict_to_sequence(d):
"""Returns an internal sequence dictionary update."""
if hasattr(d, 'items'):
d = d.items()
return d
def super_len(o):
total_length = None
current_position = 0
if hasattr(o, '__len__'):
total_length = len(o)
elif hasattr(o, 'len'):
total_length = o.len
elif hasattr(o, 'fileno'):
try:
fileno = o.fileno()
except io.UnsupportedOperation:
pass
else:
total_length = os.fstat(fileno).st_size
# Having used fstat to determine the file length, we need to
# confirm that this file was opened up in binary mode.
if 'b' not in o.mode:
warnings.warn((
"Requests has determined the content-length for this "
"request using the binary size of the file: however, the "
"file has been opened in text mode (i.e. without the 'b' "
"flag in the mode). This may lead to an incorrect "
"content-length. In Requests 3.0, support will be removed "
"for files in text mode."),
FileModeWarning
)
if hasattr(o, 'tell'):
try:
current_position = o.tell()
except (OSError, IOError):
# This can happen in some weird situations, such as when the file
# is actually a special file descriptor like stdin. In this
# instance, we don't know what the length is, so set it to zero and
# let requests chunk it instead.
if total_length is not None:
current_position = total_length
else:
if hasattr(o, 'seek') and total_length is None:
# StringIO and BytesIO have seek but no useable fileno
try:
# seek to end of file
o.seek(0, 2)
total_length = o.tell()
# seek back to current position to support
# partially read file-like objects
o.seek(current_position or 0)
except (OSError, IOError):
total_length = 0
if total_length is None:
total_length = 0
return max(0, total_length - current_position)
def get_netrc_auth(url, raise_errors=False):
"""Returns the Requests tuple auth for a given url from netrc."""
try:
from netrc import netrc, NetrcParseError
netrc_path = None
for f in NETRC_FILES:
try:
loc = os.path.expanduser('~/{0}'.format(f))
except KeyError:
# os.path.expanduser can fail when $HOME is undefined and
# getpwuid fails. See http://bugs.python.org/issue20164 &
# https://github.com/requests/requests/issues/1846
return
if os.path.exists(loc):
netrc_path = loc
break
# Abort early if there isn't one.
if netrc_path is None:
return
ri = urlparse(url)
# Strip port numbers from netloc. This weird `if...encode`` dance is
# used for Python 3.2, which doesn't support unicode literals.
splitstr = b':'
if isinstance(url, str):
splitstr = splitstr.decode('ascii')
host = ri.netloc.split(splitstr)[0]
try:
_netrc = netrc(netrc_path).authenticators(host)
if _netrc:
# Return with login / password
login_i = (0 if _netrc[0] else 1)
return (_netrc[login_i], _netrc[2])
except (NetrcParseError, IOError):
# If there was a parsing error or a permissions issue reading the file,
# we'll just skip netrc auth unless explicitly asked to raise errors.
if raise_errors:
raise
# AppEngine hackiness.
except (ImportError, AttributeError):
pass
def guess_filename(obj):
"""Tries to guess the filename of the given object."""
name = getattr(obj, 'name', None)
if (name and isinstance(name, basestring) and name[0] != '<' and
name[-1] != '>'):
return os.path.basename(name)
def from_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,
::
>>> from_key_val_list([('key', 'val')])
OrderedDict([('key', 'val')])
>>> from_key_val_list('string')
ValueError: need more than 1 value to unpack
>>> from_key_val_list({'key': 'val'})
OrderedDict([('key', 'val')])
:rtype: OrderedDict
"""
if value is None:
return None
if isinstance(value, (str, bytes, bool, int)):
raise ValueError('cannot encode objects that are not 2-tuples')
return OrderedDict(value)
def to_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,
::
>>> to_key_val_list([('key', 'val')])
[('key', 'val')]
>>> to_key_val_list({'key': 'val'})
[('key', 'val')]
>>> to_key_val_list('string')
ValueError: cannot encode objects that are not 2-tuples.
:rtype: list
"""
if value is None:
return None
if isinstance(value, (str, bytes, bool, int)):
raise ValueError('cannot encode objects that are not 2-tuples')
if isinstance(value, collections.Mapping):
value = value.items()
return list(value)
# From mitsuhiko/werkzeug (used with permission).
def parse_list_header(value):
"""Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed automatically after parsing.
It basically works like :func:`parse_set_header` just that items
may appear multiple times and case sensitivity is preserved.
The return value is a standard :class:`list`:
>>> parse_list_header('token, "quoted value"')
['token', 'quoted value']
To create a header from the :class:`list` again, use the
:func:`dump_header` function.
:param value: a string with a list header.
:return: :class:`list`
:rtype: list
"""
result = []
for item in _parse_list_header(value):
if item[:1] == item[-1:] == '"':
item = unquote_header_value(item[1:-1])
result.append(item)
return result
# From mitsuhiko/werkzeug (used with permission).
def parse_dict_header(value):
"""Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]
If there is no value for a key it will be `None`:
>>> parse_dict_header('key_without_value')
{'key_without_value': None}
To create a header from the :class:`dict` again, use the
:func:`dump_header` function.
:param value: a string with a dict header.
:return: :class:`dict`
:rtype: dict
"""
result = {}
for item in _parse_list_header(value):
if '=' not in item:
result[item] = None
continue
name, value = item.split('=', 1)
if value[:1] == value[-1:] == '"':
value = unquote_header_value(value[1:-1])
result[name] = value
return result
# From mitsuhiko/werkzeug (used with permission).
def unquote_header_value(value, is_filename=False):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
:param value: the header value to unquote.
:rtype: str
"""
if value and value[0] == value[-1] == '"':
# this is not the real unquoting, but fixing this so that the
# RFC is met will result in bugs with internet explorer and
# probably some other browsers as well. IE for example is
# uploading files with "C:\foo\bar.txt" as filename
value = value[1:-1]
# if this is a filename and the starting characters look like
# a UNC path, then just return the value without quotes. Using the
# replace sequence below on a UNC path has the effect of turning
# the leading double slash into a single slash and then
# _fix_ie_filename() doesn't work correctly. See #458.
if not is_filename or value[:2] != '\\\\':
return value.replace('\\\\', '\\').replace('\\"', '"')
return value
def dict_from_cookiejar(cj):
"""Returns a key/value dictionary from a CookieJar.
:param cj: CookieJar object to extract cookies from.
:rtype: dict
"""
cookie_dict = {}
for cookie in cj:
cookie_dict[cookie.name] = cookie.value
return cookie_dict
def add_dict_to_cookiejar(cj, cookie_dict):
"""Returns a CookieJar from a key/value dictionary.
:param cj: CookieJar to insert cookies into.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:rtype: CookieJar
"""
return cookiejar_from_dict(cookie_dict, cj)
def get_encodings_from_content(content):
"""Returns encodings from given content string.
:param content: bytestring to extract encodings from.
"""
warnings.warn((
'In requests 3.0, get_encodings_from_content will be removed. For '
'more information, please see the discussion on issue #2266. (This'
' warning should only appear once.)'),
DeprecationWarning)
charset_re = re.compile(r'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
pragma_re = re.compile(r'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
return (charset_re.findall(content) +
pragma_re.findall(content) +
xml_re.findall(content))
def get_encoding_from_headers(headers):
"""Returns encodings from given HTTP Header Dict.
:param headers: dictionary to extract encoding from.
:rtype: str
"""
content_type = headers.get('content-type')
if not content_type:
return None
content_type, params = cgi.parse_header(content_type)
if 'charset' in params:
return params['charset'].strip("'\"")
if 'text' in content_type:
return 'ISO-8859-1'
def stream_decode_response_unicode(iterator, r):
"""Stream decodes a iterator."""
if r.encoding is None:
for item in iterator:
yield item
return
decoder = codecs.getincrementaldecoder(r.encoding)(errors='replace')
for chunk in iterator:
rv = decoder.decode(chunk)
if rv:
yield rv
rv = decoder.decode(b'', final=True)
if rv:
yield rv
def iter_slices(string, slice_length):
"""Iterate over slices of a string."""
pos = 0
if slice_length is None or slice_length <= 0:
slice_length = len(string)
while pos < len(string):
yield string[pos:pos + slice_length]
pos += slice_length
def get_unicode_from_response(r):
"""Returns the requested content back in unicode.
:param r: Response object to get unicode content from.
Tried:
1. charset from content-type
2. fall back and replace all unicode characters
:rtype: str
"""
warnings.warn((
'In requests 3.0, get_unicode_from_response will be removed. For '
'more information, please see the discussion on issue #2266. (This'
' warning should only appear once.)'),
DeprecationWarning)
tried_encodings = []
# Try charset from content-type
encoding = get_encoding_from_headers(r.headers)
if encoding:
try:
return str(r.content, encoding)
except UnicodeError:
tried_encodings.append(encoding)
# Fall back:
try:
return str(r.content, encoding, errors='replace')
except TypeError:
return r.content
# The unreserved URI characters (RFC 3986)
UNRESERVED_SET = frozenset(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~")
def unquote_unreserved(uri):
"""Un-escape any percent-escape sequences in a URI that are unreserved
characters. This leaves all reserved, illegal and non-ASCII bytes encoded.
:rtype: str
"""
parts = uri.split('%')
for i in range(1, len(parts)):
h = parts[i][0:2]
if len(h) == 2 and h.isalnum():
try:
c = chr(int(h, 16))
except ValueError:
raise InvalidURL("Invalid percent-escape sequence: '%s'" % h)
if c in UNRESERVED_SET:
parts[i] = c + parts[i][2:]
else:
parts[i] = '%' + parts[i]
else:
parts[i] = '%' + parts[i]
return ''.join(parts)
def requote_uri(uri):
"""Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
:rtype: str
"""
safe_with_percent = "!#$%&'()*+,/:;=?@[]~"
safe_without_percent = "!#$&'()*+,/:;=?@[]~"
try:
# Unquote only the unreserved characters
# Then quote only illegal characters (do not quote reserved,
# unreserved, or '%')
return quote(unquote_unreserved(uri), safe=safe_with_percent)
except InvalidURL:
# We couldn't unquote the given URI, so let's try quoting it, but
# there may be unquoted '%'s in the URI. We need to make sure they're
# properly quoted so they do not cause issues elsewhere.
return quote(uri, safe=safe_without_percent)
def address_in_network(ip, net):
"""This function allows you to check if an IP belongs to a network subnet
Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
:rtype: bool
"""
ipaddr = struct.unpack('=L', socket.inet_aton(ip))[0]
netaddr, bits = net.split('/')
netmask = struct.unpack('=L', socket.inet_aton(dotted_netmask(int(bits))))[0]
network = struct.unpack('=L', socket.inet_aton(netaddr))[0] & netmask
return (ipaddr & netmask) == (network & netmask)
def dotted_netmask(mask):
"""Converts mask from /xx format to xxx.xxx.xxx.xxx
Example: if mask is 24 function returns 255.255.255.0
:rtype: str
"""
bits = 0xffffffff ^ (1 << 32 - mask) - 1
return socket.inet_ntoa(struct.pack('>I', bits))
def is_ipv4_address(string_ip):
"""
:rtype: bool
"""
try:
socket.inet_aton(string_ip)
except socket.error:
return False
return True
def is_valid_cidr(string_network):
"""
Very simple check of the cidr format in no_proxy variable.
:rtype: bool
"""
if string_network.count('/') == 1:
try:
mask = int(string_network.split('/')[1])
except ValueError:
return False
if mask < 1 or mask > 32:
return False
try:
socket.inet_aton(string_network.split('/')[0])
except socket.error:
return False
else:
return False
return True
@contextlib.contextmanager
def set_environ(env_name, value):
"""Set the environment variable 'env_name' to 'value'
Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.
If 'value' is None, do nothing"""
value_changed = value is not None
if value_changed:
old_value = os.environ.get(env_name)
os.environ[env_name] = value
try:
yield
finally:
if value_changed:
if old_value is None:
del os.environ[env_name]
else:
os.environ[env_name] = old_value
def should_bypass_proxies(url, no_proxy):
"""
Returns whether we should bypass proxies or not.
:rtype: bool
"""
get_proxy = lambda k: os.environ.get(k) or os.environ.get(k.upper())
# First check whether no_proxy is defined. If it is, check that the URL
# we're getting isn't in the no_proxy list.
no_proxy_arg = no_proxy
if no_proxy is None:
no_proxy = get_proxy('no_proxy')
netloc = urlparse(url).netloc
if no_proxy:
# We need to check whether we match here. We need to see if we match
# the end of the netloc, both with and without the port.
no_proxy = (
host for host in no_proxy.replace(' ', '').split(',') if host
)
ip = netloc.split(':')[0]
if is_ipv4_address(ip):
for proxy_ip in no_proxy:
if is_valid_cidr(proxy_ip):
if address_in_network(ip, proxy_ip):
return True
elif ip == proxy_ip:
# If no_proxy ip was defined in plain IP notation instead of cidr notation &
# matches the IP of the index
return True
else:
for host in no_proxy:
if netloc.endswith(host) or netloc.split(':')[0].endswith(host):
# The URL does match something in no_proxy, so we don't want
# to apply the proxies on this URL.
return True
# If the system proxy settings indicate that this URL should be bypassed,
# don't proxy.
# The proxy_bypass function is incredibly buggy on OS X in early versions
# of Python 2.6, so allow this call to fail. Only catch the specific
# exceptions we've seen, though: this call failing in other ways can reveal
# legitimate problems.
with set_environ('no_proxy', no_proxy_arg):
try:
bypass = proxy_bypass(netloc)
except (TypeError, socket.gaierror):
bypass = False
if bypass:
return True
return False
def get_environ_proxies(url, no_proxy=None):
"""
Return a dict of environment proxies.
:rtype: dict
"""
if should_bypass_proxies(url, no_proxy=no_proxy):
return {}
else:
return getproxies()
def select_proxy(url, proxies):
"""Select a proxy for the url, if applicable.
:param url: The url being for the request
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
"""
proxies = proxies or {}
urlparts = urlparse(url)
if urlparts.hostname is None:
return proxies.get(urlparts.scheme, proxies.get('all'))
proxy_keys = [
urlparts.scheme + '://' + urlparts.hostname,
urlparts.scheme,
'all://' + urlparts.hostname,
'all',
]
proxy = None
for proxy_key in proxy_keys:
if proxy_key in proxies:
proxy = proxies[proxy_key]
break
return proxy
def default_user_agent(name="python-requests"):
"""
Return a string representing the default user agent.
:rtype: str
"""
return '%s/%s' % (name, __version__)
def default_headers():
"""
:rtype: requests.structures.CaseInsensitiveDict
"""
return CaseInsensitiveDict({
'User-Agent': default_user_agent(),
'Accept-Encoding': ', '.join(('gzip', 'deflate')),
'Accept': '*/*',
'Connection': 'keep-alive',
})
def parse_header_links(value):
"""Return a dict of parsed link headers proxies.
i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"
:rtype: list
"""
links = []
replace_chars = ' \'"'
for val in re.split(', *<', value):
try:
url, params = val.split(';', 1)
except ValueError:
url, params = val, ''
link = {'url': url.strip('<> \'"')}
for param in params.split(';'):
try:
key, value = param.split('=')
except ValueError:
break
link[key.strip(replace_chars)] = value.strip(replace_chars)
links.append(link)
return links
# Null bytes; no need to recreate these on each call to guess_json_utf
_null = '\x00'.encode('ascii') # encoding to ASCII for Python 3
_null2 = _null * 2
_null3 = _null * 3
def guess_json_utf(data):
"""
:rtype: str
"""
# JSON always starts with two ASCII characters, so detection is as
# easy as counting the nulls and from their location and count
# determine the encoding. Also detect a BOM, if present.
sample = data[:4]
if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE):
return 'utf-32' # BOM included
if sample[:3] == codecs.BOM_UTF8:
return 'utf-8-sig' # BOM included, MS style (discouraged)
if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE):
return 'utf-16' # BOM included
nullcount = sample.count(_null)
if nullcount == 0:
return 'utf-8'
if nullcount == 2:
if sample[::2] == _null2: # 1st and 3rd are null
return 'utf-16-be'
if sample[1::2] == _null2: # 2nd and 4th are null
return 'utf-16-le'
# Did not detect 2 valid UTF-16 ascii-range characters
if nullcount == 3:
if sample[:3] == _null3:
return 'utf-32-be'
if sample[1:] == _null3:
return 'utf-32-le'
# Did not detect a valid UTF-32 ascii-range character
return None
def prepend_scheme_if_needed(url, new_scheme):
"""Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.
:rtype: str
"""
scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)
# urlparse is a finicky beast, and sometimes decides that there isn't a
# netloc present. Assume that it's being over-cautious, and switch netloc
# and path if urlparse decided there was no netloc.
if not netloc:
netloc, path = path, netloc
return urlunparse((scheme, netloc, path, params, query, fragment))
def get_auth_from_url(url):
"""Given a url with authentication components, extract them into a tuple of
username,password.
:rtype: (str,str)
"""
parsed = urlparse(url)
try:
auth = (unquote(parsed.username), unquote(parsed.password))
except (AttributeError, TypeError):
auth = ('', '')
return auth
# Moved outside of function to avoid recompile every call
_CLEAN_HEADER_REGEX_BYTE = re.compile(b'^\\S[^\\r\\n]*$|^$')
_CLEAN_HEADER_REGEX_STR = re.compile(r'^\S[^\r\n]*$|^$')
def check_header_validity(header):
"""Verifies that header value is a string which doesn't contain
leading whitespace or return characters. This prevents unintended
header injection.
:param header: tuple, in the format (name, value).
"""
name, value = header
if isinstance(value, bytes):
pat = _CLEAN_HEADER_REGEX_BYTE
else:
pat = _CLEAN_HEADER_REGEX_STR
try:
if not pat.match(value):
raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
except TypeError:
raise InvalidHeader("Value for header {%s: %s} must be of type str or "
"bytes, not %s" % (name, value, type(value)))
def urldefragauth(url):
"""
Given a url remove the fragment and the authentication part.
:rtype: str
"""
scheme, netloc, path, params, query, fragment = urlparse(url)
# see func:`prepend_scheme_if_needed`
if not netloc:
netloc, path = path, netloc
netloc = netloc.rsplit('@', 1)[-1]
return urlunparse((scheme, netloc, path, params, query, ''))
def rewind_body(prepared_request):
"""Move file pointer back to its recorded starting position
so it can be read again on redirect.
"""
body_seek = getattr(prepared_request.body, 'seek', None)
if body_seek is not None and isinstance(prepared_request._body_position, integer_types):
try:
body_seek(prepared_request._body_position)
except (IOError, OSError):
raise UnrewindableBodyError("An error occurred when rewinding request "
"body for redirect.")
else:
raise UnrewindableBodyError("Unable to rewind request body for redirect.")

16
requirements.txt Normal file
View File

@@ -0,0 +1,16 @@
-e .[socks]
pytest>=2.8.0
codecov
pytest-httpbin==0.0.7
pytest-mock
pytest-cov
pytest-xdist
alabaster
readme_renderer
Sphinx<=1.5.5
PySocks
setuptools>=18.5
docutils
flake8
tox
detox

2
setup.cfg Normal file
View File

@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1

125
setup.py Normal file → Executable file
View File

@@ -1,51 +1,100 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
from distutils.core import setup
from codecs import open
from setuptools import setup
from setuptools.command.test import test as TestCommand
if sys.argv[-1] == "publish":
os.system("python setup.py sdist upload")
sys.exit()
here = os.path.abspath(os.path.dirname(__file__))
if sys.argv[-1] == "test":
os.system("python test_requests.py")
sys.exit()
required = []
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
# if python > 2.6, require simplejson
def initialize_options(self):
TestCommand.initialize_options(self)
try:
from multiprocessing import cpu_count
self.pytest_args = ['-n', str(cpu_count()), '--boxed']
except (ImportError, NotImplementedError):
self.pytest_args = ['-n', '1', '--boxed']
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
# 'setup.py publish' shortcut.
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist bdist_wheel')
os.system('twine upload dist/*')
sys.exit()
packages = ['requests']
requires = [
'chardet>=3.0.2,<3.1.0',
'idna>=2.5,<2.7',
'urllib3>=1.21.1,<1.23',
'certifi>=2017.4.17'
]
test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']
about = {}
with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:
exec(f.read(), about)
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with open('HISTORY.rst', 'r', 'utf-8') as f:
history = f.read()
setup(
name='requests',
version='0.2.3',
description='Awesome Python HTTP Library that\'s actually usable.',
long_description=open('README.rst').read() + '\n\n' +
open('HISTORY.rst').read(),
author='Kenneth Reitz',
author_email='me@kennethreitz.com',
url='https://github.com/kennethreitz/requests',
packages= [
'requests',
'requests.packages',
'requests.packages.poster'
],
install_requires=required,
license='ISC',
classifiers=(
# 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: ISC License (ISCL)',
'Programming Language :: Python',
# 'Programming Language :: Python :: 2.5',
name=about['__title__'],
version=about['__version__'],
description=about['__description__'],
long_description=readme + '\n\n' + history,
author=about['__author__'],
author_email=about['__author_email__'],
url=about['__url__'],
packages=packages,
package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},
package_dir={'requests': 'requests'},
include_package_data=True,
install_requires=requires,
license=about['__license__'],
zip_safe=False,
classifiers=(
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
# 'Programming Language :: Python :: 3.0',
# 'Programming Language :: Python :: 3.1',
),
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
),
cmdclass={'test': PyTest},
tests_require=test_requirements,
extras_require={
'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],
'socks': ['PySocks>=1.5.6, !=1.5.7'],
'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],
},
)

View File

@@ -1,87 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from cStringIO import StringIO
import requests
class RequestsTestSuite(unittest.TestCase):
"""Requests test cases."""
def setUp(self):
pass
def tearDown(self):
"""Teardown."""
pass
def test_invalid_url(self):
self.assertRaises(ValueError, requests.get, 'hiwpefhipowhefopw')
def test_HTTP_200_OK_GET(self):
r = requests.get('http://google.com')
self.assertEqual(r.status_code, 200)
def test_HTTPS_200_OK_GET(self):
r = requests.get('https://google.com')
self.assertEqual(r.status_code, 200)
def test_HTTP_200_OK_HEAD(self):
r = requests.head('http://google.com')
self.assertEqual(r.status_code, 200)
def test_HTTPS_200_OK_HEAD(self):
r = requests.head('https://google.com')
self.assertEqual(r.status_code, 200)
def test_AUTH_HTTPS_200_OK_GET(self):
auth = requests.AuthObject('requeststest', 'requeststest')
url = 'https://convore.com/api/account/verify.json'
r = requests.get(url, auth=auth)
self.assertEqual(r.status_code, 200)
def test_POSTBIN_GET_POST_FILES(self):
bin = requests.post('http://www.postbin.org/')
self.assertEqual(bin.status_code, 200)
post = requests.post(bin.url, data={'some': 'data'})
self.assertEqual(post.status_code, 201)
post2 = requests.post(bin.url, files={'some': StringIO('data')})
self.assertEqual(post2.status_code, 201)
def test_nonzero_evaluation(self):
r = requests.get('http://google.com/some-404-url')
self.assertEqual(bool(r), False)
r = requests.get('http://google.com/')
self.assertEqual(bool(r), True)
def test_request_ok_set(self):
r = requests.get('http://google.com/some-404-url')
self.assertEqual(r.ok, False)
def test_status_raising(self):
r = requests.get('http://google.com/some-404-url')
self.assertRaises(requests.HTTPError, r.raise_for_status)
r = requests.get('http://google.com/')
self.assertFalse(r.error)
r.raise_for_status()
if __name__ == '__main__':
unittest.main()

13
tests/__init__.py Normal file
View File

@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
"""Requests test package initialisation."""
import warnings
import urllib3
from urllib3.exceptions import SNIMissingWarning
# urllib3 sets SNIMissingWarning to only go off once,
# while this test suite requires it to always fire
# so that it occurs during test_requests.test_https_warnings
warnings.simplefilter('always', SNIMissingWarning)

21
tests/compat.py Normal file
View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from requests.compat import is_py3
try:
import StringIO
except ImportError:
import io as StringIO
try:
from cStringIO import StringIO as cStringIO
except ImportError:
cStringIO = None
if is_py3:
def u(s):
return s
else:
def u(s):
return s.decode('unicode-escape')

24
tests/conftest.py Normal file
View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
import pytest
from requests.compat import urljoin
def prepare_url(value):
# Issue #1483: Make sure the URL always has a trailing slash
httpbin_url = value.url.rstrip('/') + '/'
def inner(*suffix):
return urljoin(httpbin_url, '/'.join(suffix))
return inner
@pytest.fixture
def httpbin(httpbin):
return prepare_url(httpbin)
@pytest.fixture
def httpbin_secure(httpbin_secure):
return prepare_url(httpbin_secure)

40
tests/test_help.py Normal file
View File

@@ -0,0 +1,40 @@
# -*- encoding: utf-8
import sys
import pytest
from requests.help import info
@pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6")
def test_system_ssl_py26():
"""OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't
blow up in this case.
"""
assert info()['system_ssl'] == {'version': ''}
@pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+")
def test_system_ssl():
"""Verify we're actually setting system_ssl when it should be available."""
assert info()['system_ssl']['version'] != ''
class VersionedPackage(object):
def __init__(self, version):
self.__version__ = version
def test_idna_without_version_attribute(mocker):
"""Older versions of IDNA don't provide a __version__ attribute, verify
that if we have such a package, we don't blow up.
"""
mocker.patch('requests.help.idna', new=None)
assert info()['idna'] == {'version': ''}
def test_idna_with_version_attribute(mocker):
"""Verify we're actually setting idna version when it should be available."""
mocker.patch('requests.help.idna', new=VersionedPackage('2.6'))
assert info()['idna'] == {'version': '2.6'}

23
tests/test_hooks.py Normal file
View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
import pytest
from requests import hooks
def hook(value):
return value[1:]
@pytest.mark.parametrize(
'hooks_list, result', (
(hook, 'ata'),
([hook, lambda x: None, hook], 'ta'),
)
)
def test_hooks(hooks_list, result):
assert hooks.dispatch_hook('response', {'response': hooks_list}, 'Data') == result
def test_default_hooks():
assert hooks.default_hooks() == {'response': []}

237
tests/test_lowlevel.py Normal file
View File

@@ -0,0 +1,237 @@
# -*- coding: utf-8 -*-
import pytest
import threading
import requests
from tests.testserver.server import Server, consume_socket_content
from .utils import override_environ
def test_chunked_upload():
"""can safely send generators"""
close_server = threading.Event()
server = Server.basic_response_server(wait_to_close_event=close_server)
data = iter([b'a', b'b', b'c'])
with server as (host, port):
url = 'http://{0}:{1}/'.format(host, port)
r = requests.post(url, data=data, stream=True)
close_server.set() # release server block
assert r.status_code == 200
assert r.request.headers['Transfer-Encoding'] == 'chunked'
def test_digestauth_401_count_reset_on_redirect():
"""Ensure we correctly reset num_401_calls after a successful digest auth,
followed by a 302 redirect to another digest auth prompt.
See https://github.com/requests/requests/issues/1979.
"""
text_401 = (b'HTTP/1.1 401 UNAUTHORIZED\r\n'
b'Content-Length: 0\r\n'
b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'
b', opaque="372825293d1c26955496c80ed6426e9e", '
b'realm="me@kennethreitz.com", qop=auth\r\n\r\n')
text_302 = (b'HTTP/1.1 302 FOUND\r\n'
b'Content-Length: 0\r\n'
b'Location: /\r\n\r\n')
text_200 = (b'HTTP/1.1 200 OK\r\n'
b'Content-Length: 0\r\n\r\n')
expected_digest = (b'Authorization: Digest username="user", '
b'realm="me@kennethreitz.com", '
b'nonce="6bf5d6e4da1ce66918800195d6b9130d", uri="/"')
auth = requests.auth.HTTPDigestAuth('user', 'pass')
def digest_response_handler(sock):
# Respond to initial GET with a challenge.
request_content = consume_socket_content(sock, timeout=0.5)
assert request_content.startswith(b"GET / HTTP/1.1")
sock.send(text_401)
# Verify we receive an Authorization header in response, then redirect.
request_content = consume_socket_content(sock, timeout=0.5)
assert expected_digest in request_content
sock.send(text_302)
# Verify Authorization isn't sent to the redirected host,
# then send another challenge.
request_content = consume_socket_content(sock, timeout=0.5)
assert b'Authorization:' not in request_content
sock.send(text_401)
# Verify Authorization is sent correctly again, and return 200 OK.
request_content = consume_socket_content(sock, timeout=0.5)
assert expected_digest in request_content
sock.send(text_200)
return request_content
close_server = threading.Event()
server = Server(digest_response_handler, wait_to_close_event=close_server)
with server as (host, port):
url = 'http://{0}:{1}/'.format(host, port)
r = requests.get(url, auth=auth)
# Verify server succeeded in authenticating.
assert r.status_code == 200
# Verify Authorization was sent in final request.
assert 'Authorization' in r.request.headers
assert r.request.headers['Authorization'].startswith('Digest ')
# Verify redirect happened as we expected.
assert r.history[0].status_code == 302
close_server.set()
def test_digestauth_401_only_sent_once():
"""Ensure we correctly respond to a 401 challenge once, and then
stop responding if challenged again.
"""
text_401 = (b'HTTP/1.1 401 UNAUTHORIZED\r\n'
b'Content-Length: 0\r\n'
b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'
b', opaque="372825293d1c26955496c80ed6426e9e", '
b'realm="me@kennethreitz.com", qop=auth\r\n\r\n')
expected_digest = (b'Authorization: Digest username="user", '
b'realm="me@kennethreitz.com", '
b'nonce="6bf5d6e4da1ce66918800195d6b9130d", uri="/"')
auth = requests.auth.HTTPDigestAuth('user', 'pass')
def digest_failed_response_handler(sock):
# Respond to initial GET with a challenge.
request_content = consume_socket_content(sock, timeout=0.5)
assert request_content.startswith(b"GET / HTTP/1.1")
sock.send(text_401)
# Verify we receive an Authorization header in response, then
# challenge again.
request_content = consume_socket_content(sock, timeout=0.5)
assert expected_digest in request_content
sock.send(text_401)
# Verify the client didn't respond to second challenge.
request_content = consume_socket_content(sock, timeout=0.5)
assert request_content == b''
return request_content
close_server = threading.Event()
server = Server(digest_failed_response_handler, wait_to_close_event=close_server)
with server as (host, port):
url = 'http://{0}:{1}/'.format(host, port)
r = requests.get(url, auth=auth)
# Verify server didn't authenticate us.
assert r.status_code == 401
assert r.history[0].status_code == 401
close_server.set()
def test_digestauth_only_on_4xx():
"""Ensure we only send digestauth on 4xx challenges.
See https://github.com/requests/requests/issues/3772.
"""
text_200_chal = (b'HTTP/1.1 200 OK\r\n'
b'Content-Length: 0\r\n'
b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'
b', opaque="372825293d1c26955496c80ed6426e9e", '
b'realm="me@kennethreitz.com", qop=auth\r\n\r\n')
auth = requests.auth.HTTPDigestAuth('user', 'pass')
def digest_response_handler(sock):
# Respond to GET with a 200 containing www-authenticate header.
request_content = consume_socket_content(sock, timeout=0.5)
assert request_content.startswith(b"GET / HTTP/1.1")
sock.send(text_200_chal)
# Verify the client didn't respond with auth.
request_content = consume_socket_content(sock, timeout=0.5)
assert request_content == b''
return request_content
close_server = threading.Event()
server = Server(digest_response_handler, wait_to_close_event=close_server)
with server as (host, port):
url = 'http://{0}:{1}/'.format(host, port)
r = requests.get(url, auth=auth)
# Verify server didn't receive auth from us.
assert r.status_code == 200
assert len(r.history) == 0
close_server.set()
_schemes_by_var_prefix = [
('http', ['http']),
('https', ['https']),
('all', ['http', 'https']),
]
_proxy_combos = []
for prefix, schemes in _schemes_by_var_prefix:
for scheme in schemes:
_proxy_combos.append(("{0}_proxy".format(prefix), scheme))
_proxy_combos += [(var.upper(), scheme) for var, scheme in _proxy_combos]
@pytest.mark.parametrize("var,scheme", _proxy_combos)
def test_use_proxy_from_environment(httpbin, var, scheme):
url = "{0}://httpbin.org".format(scheme)
fake_proxy = Server() # do nothing with the requests; just close the socket
with fake_proxy as (host, port):
proxy_url = "socks5://{0}:{1}".format(host, port)
kwargs = {var: proxy_url}
with override_environ(**kwargs):
# fake proxy's lack of response will cause a ConnectionError
with pytest.raises(requests.exceptions.ConnectionError):
requests.get(url)
# the fake proxy received a request
assert len(fake_proxy.handler_results) == 1
# it had actual content (not checking for SOCKS protocol for now)
assert len(fake_proxy.handler_results[0]) > 0
def test_redirect_rfc1808_to_non_ascii_location():
path = u'š'
expected_path = b'%C5%A1'
redirect_request = [] # stores the second request to the server
def redirect_resp_handler(sock):
consume_socket_content(sock, timeout=0.5)
location = u'//{0}:{1}/{2}'.format(host, port, path)
sock.send(
b'HTTP/1.1 301 Moved Permanently\r\n'
b'Content-Length: 0\r\n'
b'Location: ' + location.encode('utf8') + b'\r\n'
b'\r\n'
)
redirect_request.append(consume_socket_content(sock, timeout=0.5))
sock.send(b'HTTP/1.1 200 OK\r\n\r\n')
close_server = threading.Event()
server = Server(redirect_resp_handler, wait_to_close_event=close_server)
with server as (host, port):
url = u'http://{0}:{1}'.format(host, port)
r = requests.get(url=url, allow_redirects=True)
assert r.status_code == 200
assert len(r.history) == 1
assert r.history[0].status_code == 301
assert redirect_request[0].startswith(b'GET /' + expected_path + b' HTTP/1.1')
assert r.url == u'{0}/{1}'.format(url, expected_path.decode('ascii'))
close_server.set()

13
tests/test_packages.py Normal file
View File

@@ -0,0 +1,13 @@
import requests
def test_can_access_urllib3_attribute():
requests.packages.urllib3
def test_can_access_idna_attribute():
requests.packages.idna
def test_can_access_chardet_attribute():
requests.packages.chardet

2389
tests/test_requests.py Normal file

File diff suppressed because it is too large Load Diff

76
tests/test_structures.py Normal file
View File

@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
import pytest
from requests.structures import CaseInsensitiveDict, LookupDict
class TestCaseInsensitiveDict:
@pytest.fixture(autouse=True)
def setup(self):
"""CaseInsensitiveDict instance with "Accept" header."""
self.case_insensitive_dict = CaseInsensitiveDict()
self.case_insensitive_dict['Accept'] = 'application/json'
def test_list(self):
assert list(self.case_insensitive_dict) == ['Accept']
possible_keys = pytest.mark.parametrize('key', ('accept', 'ACCEPT', 'aCcEpT', 'Accept'))
@possible_keys
def test_getitem(self, key):
assert self.case_insensitive_dict[key] == 'application/json'
@possible_keys
def test_delitem(self, key):
del self.case_insensitive_dict[key]
assert key not in self.case_insensitive_dict
def test_lower_items(self):
assert list(self.case_insensitive_dict.lower_items()) == [('accept', 'application/json')]
def test_repr(self):
assert repr(self.case_insensitive_dict) == "{'Accept': 'application/json'}"
def test_copy(self):
copy = self.case_insensitive_dict.copy()
assert copy is not self.case_insensitive_dict
assert copy == self.case_insensitive_dict
@pytest.mark.parametrize(
'other, result', (
({'AccePT': 'application/json'}, True),
({}, False),
(None, False)
)
)
def test_instance_equality(self, other, result):
assert (self.case_insensitive_dict == other) is result
class TestLookupDict:
@pytest.fixture(autouse=True)
def setup(self):
"""LookupDict instance with "bad_gateway" attribute."""
self.lookup_dict = LookupDict('test')
self.lookup_dict.bad_gateway = 502
def test_repr(self):
assert repr(self.lookup_dict) == "<lookup 'test'>"
get_item_parameters = pytest.mark.parametrize(
'key, value', (
('bad_gateway', 502),
('not_a_key', None)
)
)
@get_item_parameters
def test_getitem(self, key, value):
assert self.lookup_dict[key] == value
@get_item_parameters
def test_get(self, key, value):
assert self.lookup_dict.get(key) == value

166
tests/test_testserver.py Normal file
View File

@@ -0,0 +1,166 @@
# -*- coding: utf-8 -*-
import threading
import socket
import time
import pytest
import requests
from tests.testserver.server import Server
class TestTestServer:
def test_basic(self):
"""messages are sent and received properly"""
question = b"success?"
answer = b"yeah, success"
def handler(sock):
text = sock.recv(1000)
assert text == question
sock.sendall(answer)
with Server(handler) as (host, port):
sock = socket.socket()
sock.connect((host, port))
sock.sendall(question)
text = sock.recv(1000)
assert text == answer
sock.close()
def test_server_closes(self):
"""the server closes when leaving the context manager"""
with Server.basic_response_server() as (host, port):
sock = socket.socket()
sock.connect((host, port))
sock.close()
with pytest.raises(socket.error):
new_sock = socket.socket()
new_sock.connect((host, port))
def test_text_response(self):
"""the text_response_server sends the given text"""
server = Server.text_response_server(
"HTTP/1.1 200 OK\r\n" +
"Content-Length: 6\r\n" +
"\r\nroflol"
)
with server as (host, port):
r = requests.get('http://{0}:{1}'.format(host, port))
assert r.status_code == 200
assert r.text == u'roflol'
assert r.headers['Content-Length'] == '6'
def test_basic_response(self):
"""the basic response server returns an empty http response"""
with Server.basic_response_server() as (host, port):
r = requests.get('http://{0}:{1}'.format(host, port))
assert r.status_code == 200
assert r.text == u''
assert r.headers['Content-Length'] == '0'
def test_basic_waiting_server(self):
"""the server waits for the block_server event to be set before closing"""
block_server = threading.Event()
with Server.basic_response_server(wait_to_close_event=block_server) as (host, port):
sock = socket.socket()
sock.connect((host, port))
sock.sendall(b'send something')
time.sleep(2.5)
sock.sendall(b'still alive')
block_server.set() # release server block
def test_multiple_requests(self):
"""multiple requests can be served"""
requests_to_handle = 5
server = Server.basic_response_server(requests_to_handle=requests_to_handle)
with server as (host, port):
server_url = 'http://{0}:{1}'.format(host, port)
for _ in range(requests_to_handle):
r = requests.get(server_url)
assert r.status_code == 200
# the (n+1)th request fails
with pytest.raises(requests.exceptions.ConnectionError):
r = requests.get(server_url)
@pytest.mark.skip(reason="this fails non-deterministically under pytest-xdist")
def test_request_recovery(self):
"""can check the requests content"""
# TODO: figure out why this sometimes fails when using pytest-xdist.
server = Server.basic_response_server(requests_to_handle=2)
first_request = b'put your hands up in the air'
second_request = b'put your hand down in the floor'
with server as address:
sock1 = socket.socket()
sock2 = socket.socket()
sock1.connect(address)
sock1.sendall(first_request)
sock1.close()
sock2.connect(address)
sock2.sendall(second_request)
sock2.close()
assert server.handler_results[0] == first_request
assert server.handler_results[1] == second_request
def test_requests_after_timeout_are_not_received(self):
"""the basic response handler times out when receiving requests"""
server = Server.basic_response_server(request_timeout=1)
with server as address:
sock = socket.socket()
sock.connect(address)
time.sleep(1.5)
sock.sendall(b'hehehe, not received')
sock.close()
assert server.handler_results[0] == b''
def test_request_recovery_with_bigger_timeout(self):
"""a biggest timeout can be specified"""
server = Server.basic_response_server(request_timeout=3)
data = b'bananadine'
with server as address:
sock = socket.socket()
sock.connect(address)
time.sleep(1.5)
sock.sendall(data)
sock.close()
assert server.handler_results[0] == data
def test_server_finishes_on_error(self):
"""the server thread exits even if an exception exits the context manager"""
server = Server.basic_response_server()
with pytest.raises(Exception):
with server:
raise Exception()
assert len(server.handler_results) == 0
# if the server thread fails to finish, the test suite will hang
# and get killed by the jenkins timeout.
def test_server_finishes_when_no_connections(self):
"""the server thread exits even if there are no connections"""
server = Server.basic_response_server()
with server:
pass
assert len(server.handler_results) == 0
# if the server thread fails to finish, the test suite will hang
# and get killed by the jenkins timeout.

680
tests/test_utils.py Normal file
View File

@@ -0,0 +1,680 @@
# -*- coding: utf-8 -*-
import os
import copy
from io import BytesIO
import pytest
from requests import compat
from requests.cookies import RequestsCookieJar
from requests.structures import CaseInsensitiveDict
from requests.utils import (
address_in_network, dotted_netmask,
get_auth_from_url, get_encoding_from_headers,
get_encodings_from_content, get_environ_proxies,
guess_filename, guess_json_utf, is_ipv4_address,
is_valid_cidr, iter_slices, parse_dict_header,
parse_header_links, prepend_scheme_if_needed,
requote_uri, select_proxy, should_bypass_proxies, super_len,
to_key_val_list, to_native_string,
unquote_header_value, unquote_unreserved,
urldefragauth, add_dict_to_cookiejar, set_environ)
from requests._internal_utils import unicode_is_ascii
from .compat import StringIO, cStringIO
class TestSuperLen:
@pytest.mark.parametrize(
'stream, value', (
(StringIO.StringIO, 'Test'),
(BytesIO, b'Test'),
pytest.mark.skipif('cStringIO is None')((cStringIO, 'Test')),
))
def test_io_streams(self, stream, value):
"""Ensures that we properly deal with different kinds of IO streams."""
assert super_len(stream()) == 0
assert super_len(stream(value)) == 4
def test_super_len_correctly_calculates_len_of_partially_read_file(self):
"""Ensure that we handle partially consumed file like objects."""
s = StringIO.StringIO()
s.write('foobarbogus')
assert super_len(s) == 0
@pytest.mark.parametrize('error', [IOError, OSError])
def test_super_len_handles_files_raising_weird_errors_in_tell(self, error):
"""If tell() raises errors, assume the cursor is at position zero."""
class BoomFile(object):
def __len__(self):
return 5
def tell(self):
raise error()
assert super_len(BoomFile()) == 0
@pytest.mark.parametrize('error', [IOError, OSError])
def test_super_len_tell_ioerror(self, error):
"""Ensure that if tell gives an IOError super_len doesn't fail"""
class NoLenBoomFile(object):
def tell(self):
raise error()
def seek(self, offset, whence):
pass
assert super_len(NoLenBoomFile()) == 0
def test_string(self):
assert super_len('Test') == 4
@pytest.mark.parametrize(
'mode, warnings_num', (
('r', 1),
('rb', 0),
))
def test_file(self, tmpdir, mode, warnings_num, recwarn):
file_obj = tmpdir.join('test.txt')
file_obj.write('Test')
with file_obj.open(mode) as fd:
assert super_len(fd) == 4
assert len(recwarn) == warnings_num
def test_super_len_with__len__(self):
foo = [1,2,3,4]
len_foo = super_len(foo)
assert len_foo == 4
def test_super_len_with_no__len__(self):
class LenFile(object):
def __init__(self):
self.len = 5
assert super_len(LenFile()) == 5
def test_super_len_with_tell(self):
foo = StringIO.StringIO('12345')
assert super_len(foo) == 5
foo.read(2)
assert super_len(foo) == 3
def test_super_len_with_fileno(self):
with open(__file__, 'rb') as f:
length = super_len(f)
file_data = f.read()
assert length == len(file_data)
def test_super_len_with_no_matches(self):
"""Ensure that objects without any length methods default to 0"""
assert super_len(object()) == 0
class TestToKeyValList:
@pytest.mark.parametrize(
'value, expected', (
([('key', 'val')], [('key', 'val')]),
((('key', 'val'), ), [('key', 'val')]),
({'key': 'val'}, [('key', 'val')]),
(None, None)
))
def test_valid(self, value, expected):
assert to_key_val_list(value) == expected
def test_invalid(self):
with pytest.raises(ValueError):
to_key_val_list('string')
class TestUnquoteHeaderValue:
@pytest.mark.parametrize(
'value, expected', (
(None, None),
('Test', 'Test'),
('"Test"', 'Test'),
('"Test\\\\"', 'Test\\'),
('"\\\\Comp\\Res"', '\\Comp\\Res'),
))
def test_valid(self, value, expected):
assert unquote_header_value(value) == expected
def test_is_filename(self):
assert unquote_header_value('"\\\\Comp\\Res"', True) == '\\\\Comp\\Res'
class TestGetEnvironProxies:
"""Ensures that IP addresses are correctly matches with ranges
in no_proxy variable.
"""
@pytest.fixture(autouse=True, params=['no_proxy', 'NO_PROXY'])
def no_proxy(self, request, monkeypatch):
monkeypatch.setenv(request.param, '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
@pytest.mark.parametrize(
'url', (
'http://192.168.0.1:5000/',
'http://192.168.0.1/',
'http://172.16.1.1/',
'http://172.16.1.1:5000/',
'http://localhost.localdomain:5000/v1.0/',
))
def test_bypass(self, url):
assert get_environ_proxies(url, no_proxy=None) == {}
@pytest.mark.parametrize(
'url', (
'http://192.168.1.1:5000/',
'http://192.168.1.1/',
'http://www.requests.com/',
))
def test_not_bypass(self, url):
assert get_environ_proxies(url, no_proxy=None) != {}
@pytest.mark.parametrize(
'url', (
'http://192.168.1.1:5000/',
'http://192.168.1.1/',
'http://www.requests.com/',
))
def test_bypass_no_proxy_keyword(self, url):
no_proxy = '192.168.1.1,requests.com'
assert get_environ_proxies(url, no_proxy=no_proxy) == {}
@pytest.mark.parametrize(
'url', (
'http://192.168.0.1:5000/',
'http://192.168.0.1/',
'http://172.16.1.1/',
'http://172.16.1.1:5000/',
'http://localhost.localdomain:5000/v1.0/',
))
def test_not_bypass_no_proxy_keyword(self, url, monkeypatch):
# This is testing that the 'no_proxy' argument overrides the
# environment variable 'no_proxy'
monkeypatch.setenv('http_proxy', 'http://proxy.example.com:3128/')
no_proxy = '192.168.1.1,requests.com'
assert get_environ_proxies(url, no_proxy=no_proxy) != {}
class TestIsIPv4Address:
def test_valid(self):
assert is_ipv4_address('8.8.8.8')
@pytest.mark.parametrize('value', ('8.8.8.8.8', 'localhost.localdomain'))
def test_invalid(self, value):
assert not is_ipv4_address(value)
class TestIsValidCIDR:
def test_valid(self):
assert is_valid_cidr('192.168.1.0/24')
@pytest.mark.parametrize(
'value', (
'8.8.8.8',
'192.168.1.0/a',
'192.168.1.0/128',
'192.168.1.0/-1',
'192.168.1.999/24',
))
def test_invalid(self, value):
assert not is_valid_cidr(value)
class TestAddressInNetwork:
def test_valid(self):
assert address_in_network('192.168.1.1', '192.168.1.0/24')
def test_invalid(self):
assert not address_in_network('172.16.0.1', '192.168.1.0/24')
class TestGuessFilename:
@pytest.mark.parametrize(
'value', (1, type('Fake', (object,), {'name': 1})()),
)
def test_guess_filename_invalid(self, value):
assert guess_filename(value) is None
@pytest.mark.parametrize(
'value, expected_type', (
(b'value', compat.bytes),
(b'value'.decode('utf-8'), compat.str)
))
def test_guess_filename_valid(self, value, expected_type):
obj = type('Fake', (object,), {'name': value})()
result = guess_filename(obj)
assert result == value
assert isinstance(result, expected_type)
class TestContentEncodingDetection:
def test_none(self):
encodings = get_encodings_from_content('')
assert not len(encodings)
@pytest.mark.parametrize(
'content', (
# HTML5 meta charset attribute
'<meta charset="UTF-8">',
# HTML4 pragma directive
'<meta http-equiv="Content-type" content="text/html;charset=UTF-8">',
# XHTML 1.x served with text/html MIME type
'<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />',
# XHTML 1.x served as XML
'<?xml version="1.0" encoding="UTF-8"?>',
))
def test_pragmas(self, content):
encodings = get_encodings_from_content(content)
assert len(encodings) == 1
assert encodings[0] == 'UTF-8'
def test_precedence(self):
content = '''
<?xml version="1.0" encoding="XML"?>
<meta charset="HTML5">
<meta http-equiv="Content-type" content="text/html;charset=HTML4" />
'''.strip()
assert get_encodings_from_content(content) == ['HTML5', 'HTML4', 'XML']
class TestGuessJSONUTF:
@pytest.mark.parametrize(
'encoding', (
'utf-32', 'utf-8-sig', 'utf-16', 'utf-8', 'utf-16-be', 'utf-16-le',
'utf-32-be', 'utf-32-le'
))
def test_encoded(self, encoding):
data = '{}'.encode(encoding)
assert guess_json_utf(data) == encoding
def test_bad_utf_like_encoding(self):
assert guess_json_utf(b'\x00\x00\x00\x00') is None
@pytest.mark.parametrize(
('encoding', 'expected'), (
('utf-16-be', 'utf-16'),
('utf-16-le', 'utf-16'),
('utf-32-be', 'utf-32'),
('utf-32-le', 'utf-32')
))
def test_guess_by_bom(self, encoding, expected):
data = u'\ufeff{}'.encode(encoding)
assert guess_json_utf(data) == expected
USER = PASSWORD = "%!*'();:@&=+$,/?#[] "
ENCODED_USER = compat.quote(USER, '')
ENCODED_PASSWORD = compat.quote(PASSWORD, '')
@pytest.mark.parametrize(
'url, auth', (
(
'http://' + ENCODED_USER + ':' + ENCODED_PASSWORD + '@' +
'request.com/url.html#test',
(USER, PASSWORD)
),
(
'http://user:pass@complex.url.com/path?query=yes',
('user', 'pass')
),
(
'http://user:pass%20pass@complex.url.com/path?query=yes',
('user', 'pass pass')
),
(
'http://user:pass pass@complex.url.com/path?query=yes',
('user', 'pass pass')
),
(
'http://user%25user:pass@complex.url.com/path?query=yes',
('user%user', 'pass')
),
(
'http://user:pass%23pass@complex.url.com/path?query=yes',
('user', 'pass#pass')
),
(
'http://complex.url.com/path?query=yes',
('', '')
),
))
def test_get_auth_from_url(url, auth):
assert get_auth_from_url(url) == auth
@pytest.mark.parametrize(
'uri, expected', (
(
# Ensure requoting doesn't break expectations
'http://example.com/fiz?buz=%25ppicture',
'http://example.com/fiz?buz=%25ppicture',
),
(
# Ensure we handle unquoted percent signs in redirects
'http://example.com/fiz?buz=%ppicture',
'http://example.com/fiz?buz=%25ppicture',
),
))
def test_requote_uri_with_unquoted_percents(uri, expected):
"""See: https://github.com/requests/requests/issues/2356"""
assert requote_uri(uri) == expected
@pytest.mark.parametrize(
'uri, expected', (
(
# Illegal bytes
'http://example.com/?a=%--',
'http://example.com/?a=%--',
),
(
# Reserved characters
'http://example.com/?a=%300',
'http://example.com/?a=00',
)
))
def test_unquote_unreserved(uri, expected):
assert unquote_unreserved(uri) == expected
@pytest.mark.parametrize(
'mask, expected', (
(8, '255.0.0.0'),
(24, '255.255.255.0'),
(25, '255.255.255.128'),
))
def test_dotted_netmask(mask, expected):
assert dotted_netmask(mask) == expected
http_proxies = {'http': 'http://http.proxy',
'http://some.host': 'http://some.host.proxy'}
all_proxies = {'all': 'socks5://http.proxy',
'all://some.host': 'socks5://some.host.proxy'}
mixed_proxies = {'http': 'http://http.proxy',
'http://some.host': 'http://some.host.proxy',
'all': 'socks5://http.proxy'}
@pytest.mark.parametrize(
'url, expected, proxies', (
('hTTp://u:p@Some.Host/path', 'http://some.host.proxy', http_proxies),
('hTTp://u:p@Other.Host/path', 'http://http.proxy', http_proxies),
('hTTp:///path', 'http://http.proxy', http_proxies),
('hTTps://Other.Host', None, http_proxies),
('file:///etc/motd', None, http_proxies),
('hTTp://u:p@Some.Host/path', 'socks5://some.host.proxy', all_proxies),
('hTTp://u:p@Other.Host/path', 'socks5://http.proxy', all_proxies),
('hTTp:///path', 'socks5://http.proxy', all_proxies),
('hTTps://Other.Host', 'socks5://http.proxy', all_proxies),
('http://u:p@other.host/path', 'http://http.proxy', mixed_proxies),
('http://u:p@some.host/path', 'http://some.host.proxy', mixed_proxies),
('https://u:p@other.host/path', 'socks5://http.proxy', mixed_proxies),
('https://u:p@some.host/path', 'socks5://http.proxy', mixed_proxies),
('https://', 'socks5://http.proxy', mixed_proxies),
# XXX: unsure whether this is reasonable behavior
('file:///etc/motd', 'socks5://http.proxy', all_proxies),
))
def test_select_proxies(url, expected, proxies):
"""Make sure we can select per-host proxies correctly."""
assert select_proxy(url, proxies) == expected
@pytest.mark.parametrize(
'value, expected', (
('foo="is a fish", bar="as well"', {'foo': 'is a fish', 'bar': 'as well'}),
('key_without_value', {'key_without_value': None})
))
def test_parse_dict_header(value, expected):
assert parse_dict_header(value) == expected
@pytest.mark.parametrize(
'value, expected', (
(
CaseInsensitiveDict(),
None
),
(
CaseInsensitiveDict({'content-type': 'application/json; charset=utf-8'}),
'utf-8'
),
(
CaseInsensitiveDict({'content-type': 'text/plain'}),
'ISO-8859-1'
),
))
def test_get_encoding_from_headers(value, expected):
assert get_encoding_from_headers(value) == expected
@pytest.mark.parametrize(
'value, length', (
('', 0),
('T', 1),
('Test', 4),
('Cont', 0),
('Other', -5),
('Content', None),
))
def test_iter_slices(value, length):
if length is None or (length <= 0 and len(value) > 0):
# Reads all content at once
assert len(list(iter_slices(value, length))) == 1
else:
assert len(list(iter_slices(value, 1))) == length
@pytest.mark.parametrize(
'value, expected', (
(
'<http:/.../front.jpeg>; rel=front; type="image/jpeg"',
[{'url': 'http:/.../front.jpeg', 'rel': 'front', 'type': 'image/jpeg'}]
),
(
'<http:/.../front.jpeg>',
[{'url': 'http:/.../front.jpeg'}]
),
(
'<http:/.../front.jpeg>;',
[{'url': 'http:/.../front.jpeg'}]
),
(
'<http:/.../front.jpeg>; type="image/jpeg",<http://.../back.jpeg>;',
[
{'url': 'http:/.../front.jpeg', 'type': 'image/jpeg'},
{'url': 'http://.../back.jpeg'}
]
),
))
def test_parse_header_links(value, expected):
assert parse_header_links(value) == expected
@pytest.mark.parametrize(
'value, expected', (
('example.com/path', 'http://example.com/path'),
('//example.com/path', 'http://example.com/path'),
))
def test_prepend_scheme_if_needed(value, expected):
assert prepend_scheme_if_needed(value, 'http') == expected
@pytest.mark.parametrize(
'value, expected', (
('T', 'T'),
(b'T', 'T'),
(u'T', 'T'),
))
def test_to_native_string(value, expected):
assert to_native_string(value) == expected
@pytest.mark.parametrize(
'url, expected', (
('http://u:p@example.com/path?a=1#test', 'http://example.com/path?a=1'),
('http://example.com/path', 'http://example.com/path'),
('//u:p@example.com/path', '//example.com/path'),
('//example.com/path', '//example.com/path'),
('example.com/path', '//example.com/path'),
('scheme:u:p@example.com/path', 'scheme://example.com/path'),
))
def test_urldefragauth(url, expected):
assert urldefragauth(url) == expected
@pytest.mark.parametrize(
'url, expected', (
('http://192.168.0.1:5000/', True),
('http://192.168.0.1/', True),
('http://172.16.1.1/', True),
('http://172.16.1.1:5000/', True),
('http://localhost.localdomain:5000/v1.0/', True),
('http://172.16.1.12/', False),
('http://172.16.1.12:5000/', False),
('http://google.com:5000/v1.0/', False),
))
def test_should_bypass_proxies(url, expected, monkeypatch):
"""Tests for function should_bypass_proxies to check if proxy
can be bypassed or not
"""
monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
assert should_bypass_proxies(url, no_proxy=None) == expected
@pytest.mark.parametrize(
'cookiejar', (
compat.cookielib.CookieJar(),
RequestsCookieJar()
))
def test_add_dict_to_cookiejar(cookiejar):
"""Ensure add_dict_to_cookiejar works for
non-RequestsCookieJar CookieJars
"""
cookiedict = {'test': 'cookies',
'good': 'cookies'}
cj = add_dict_to_cookiejar(cookiejar, cookiedict)
cookies = dict((cookie.name, cookie.value) for cookie in cj)
assert cookiedict == cookies
@pytest.mark.parametrize(
'value, expected', (
(u'test', True),
(u'æíöû', False),
(u'ジェーピーニック', False),
)
)
def test_unicode_is_ascii(value, expected):
assert unicode_is_ascii(value) is expected
@pytest.mark.parametrize(
'url, expected', (
('http://192.168.0.1:5000/', True),
('http://192.168.0.1/', True),
('http://172.16.1.1/', True),
('http://172.16.1.1:5000/', True),
('http://localhost.localdomain:5000/v1.0/', True),
('http://172.16.1.12/', False),
('http://172.16.1.12:5000/', False),
('http://google.com:5000/v1.0/', False),
))
def test_should_bypass_proxies_no_proxy(
url, expected, monkeypatch):
"""Tests for function should_bypass_proxies to check if proxy
can be bypassed or not using the 'no_proxy' argument
"""
no_proxy = '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1'
# Test 'no_proxy' argument
assert should_bypass_proxies(url, no_proxy=no_proxy) == expected
@pytest.mark.skipif(os.name != 'nt', reason='Test only on Windows')
@pytest.mark.parametrize(
'url, expected, override', (
('http://192.168.0.1:5000/', True, None),
('http://192.168.0.1/', True, None),
('http://172.16.1.1/', True, None),
('http://172.16.1.1:5000/', True, None),
('http://localhost.localdomain:5000/v1.0/', True, None),
('http://172.16.1.22/', False, None),
('http://172.16.1.22:5000/', False, None),
('http://google.com:5000/v1.0/', False, None),
('http://mylocalhostname:5000/v1.0/', True, '<local>'),
('http://192.168.0.1/', False, ''),
))
def test_should_bypass_proxies_win_registry(url, expected, override,
monkeypatch):
"""Tests for function should_bypass_proxies to check if proxy
can be bypassed or not with Windows registry settings
"""
if override is None:
override = '192.168.*;127.0.0.1;localhost.localdomain;172.16.1.1'
if compat.is_py3:
import winreg
else:
import _winreg as winreg
class RegHandle:
def Close(self):
pass
ie_settings = RegHandle()
def OpenKey(key, subkey):
return ie_settings
def QueryValueEx(key, value_name):
if key is ie_settings:
if value_name == 'ProxyEnable':
return [1]
elif value_name == 'ProxyOverride':
return [override]
monkeypatch.setenv('http_proxy', '')
monkeypatch.setenv('https_proxy', '')
monkeypatch.setenv('ftp_proxy', '')
monkeypatch.setenv('no_proxy', '')
monkeypatch.setenv('NO_PROXY', '')
monkeypatch.setattr(winreg, 'OpenKey', OpenKey)
monkeypatch.setattr(winreg, 'QueryValueEx', QueryValueEx)
@pytest.mark.parametrize(
'env_name, value', (
('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain'),
('no_proxy', None),
('a_new_key', '192.168.0.0/24,127.0.0.1,localhost.localdomain'),
('a_new_key', None),
))
def test_set_environ(env_name, value):
"""Tests set_environ will set environ values and will restore the environ."""
environ_copy = copy.deepcopy(os.environ)
with set_environ(env_name, value):
assert os.environ.get(env_name) == value
assert os.environ == environ_copy
def test_set_environ_raises_exception():
"""Tests set_environ will raise exceptions in context when the
value parameter is None."""
with pytest.raises(Exception) as exception:
with set_environ('test1', None):
raise Exception('Expected exception')
assert 'Expected exception' in str(exception.value)

View File

127
tests/testserver/server.py Normal file
View File

@@ -0,0 +1,127 @@
# -*- coding: utf-8 -*-
import threading
import socket
import select
def consume_socket_content(sock, timeout=0.5):
chunks = 65536
content = b''
while True:
more_to_read = select.select([sock], [], [], timeout)[0]
if not more_to_read:
break
new_content = sock.recv(chunks)
if not new_content:
break
content += new_content
return content
class Server(threading.Thread):
"""Dummy server using for unit testing"""
WAIT_EVENT_TIMEOUT = 5
def __init__(self, handler=None, host='localhost', port=0, requests_to_handle=1, wait_to_close_event=None):
super(Server, self).__init__()
self.handler = handler or consume_socket_content
self.handler_results = []
self.host = host
self.port = port
self.requests_to_handle = requests_to_handle
self.wait_to_close_event = wait_to_close_event
self.ready_event = threading.Event()
self.stop_event = threading.Event()
@classmethod
def text_response_server(cls, text, request_timeout=0.5, **kwargs):
def text_response_handler(sock):
request_content = consume_socket_content(sock, timeout=request_timeout)
sock.send(text.encode('utf-8'))
return request_content
return Server(text_response_handler, **kwargs)
@classmethod
def basic_response_server(cls, **kwargs):
return cls.text_response_server(
"HTTP/1.1 200 OK\r\n" +
"Content-Length: 0\r\n\r\n",
**kwargs
)
def run(self):
try:
self.server_sock = self._create_socket_and_bind()
# in case self.port = 0
self.port = self.server_sock.getsockname()[1]
self.ready_event.set()
self._handle_requests()
if self.wait_to_close_event:
self.wait_to_close_event.wait(self.WAIT_EVENT_TIMEOUT)
finally:
self.ready_event.set() # just in case of exception
self._close_server_sock_ignore_errors()
self.stop_event.set()
def _create_socket_and_bind(self):
sock = socket.socket()
sock.bind((self.host, self.port))
sock.listen(0)
return sock
def _close_server_sock_ignore_errors(self):
try:
self.server_sock.close()
except IOError:
pass
def _handle_requests(self):
for _ in range(self.requests_to_handle):
sock = self._accept_connection()
if not sock:
break
handler_result = self.handler(sock)
self.handler_results.append(handler_result)
def _accept_connection(self):
try:
ready, _, _ = select.select([self.server_sock], [], [], self.WAIT_EVENT_TIMEOUT)
if not ready:
return None
return self.server_sock.accept()[0]
except (select.error, socket.error):
return None
def __enter__(self):
self.start()
self.ready_event.wait(self.WAIT_EVENT_TIMEOUT)
return self.host, self.port
def __exit__(self, exc_type, exc_value, traceback):
if exc_type is None:
self.stop_event.wait(self.WAIT_EVENT_TIMEOUT)
else:
if self.wait_to_close_event:
# avoid server from waiting for event timeouts
# if an exception is found in the main thread
self.wait_to_close_event.set()
# ensure server thread doesn't get stuck waiting for connections
self._close_server_sock_ignore_errors()
self.join()
return False # allow exceptions to propagate

19
tests/utils.py Normal file
View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
import contextlib
import os
@contextlib.contextmanager
def override_environ(**kwargs):
save_env = dict(os.environ)
for key, value in kwargs.items():
if value is None:
del os.environ[key]
else:
os.environ[key] = value
try:
yield
finally:
os.environ.clear()
os.environ.update(save_env)

8
tox.ini Normal file
View File

@@ -0,0 +1,8 @@
[tox]
envlist = py26,py27,py33,py34,py35,py36
[testenv]
commands =
pip install -e .[socks]
python setup.py test