Commit Graph

666 Commits

Author SHA1 Message Date
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
Marcus McCurdy f60579ddda Moved fix for #747 to compat module 2012-08-04 09:35:32 -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
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 42ddc4c9e8 Need to write tests but this looks good so far. 2012-08-02 17:31:30 -04: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
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
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
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
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
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
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 b222ff9477 Merge branch 'develop' of git://github.com/siebenschlaefer/requests into develop
Conflicts:
	AUTHORS.rst
2012-07-12 12:06:43 -07:00
Cory Benfield 523906c54f Do not hide SSLErrors behind Timeouts. 2012-07-11 17:31:59 +01:00
Matthias Rahlf 08cebb3c2f fixed param handling in Request.full_url 2012-07-10 01:06:02 +02:00
Kenneth Reitz f8c98715c3 simplify #710 2012-07-08 00:24:24 -04:00
Zach Williams 25299400fa Add try/catch for simplejson vs json 2012-07-07 21:14:29 -07:00
Kenneth Reitz 6541ceb5f5 Merge remote-tracking branch 'origin/develop' into develop 2012-06-28 16:00:40 -07:00
Kenneth Reitz a17fdf6224 chardet2 2012-06-28 16:00:00 -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 c7514faf4a add response.reason
#588
2012-06-15 14:37:33 -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 843672f4fe make empty body text responses work
#660
2012-06-07 21:55:07 -04: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 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
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
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 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
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
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
Roman Haritonov 33f1087584 Move session cookie saving from Session.request() to Request._build_response() 2012-05-08 13:02:39 +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 fe7348cc53 yay json
fixes #593
2012-05-08 00:57:46 -04:00
barberj 3288426f2b added unicode strings 2012-05-06 15:14:57 -07:00
barberj ed7b14899f added mutlipart file=strings 2012-05-06 15:14:40 -07: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