Commit Graph

313 Commits

Author SHA1 Message Date
Shivaram Lingamneni 35ec6bb613 fix for #458 2012-05-03 21:16:56 -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 538de55607 raise a ValueError if no encoding was sent and chardet is unavailable 2012-05-02 20:21:02 -07: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 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
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
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 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 ff169d32fe fix and test for a bug dhagrow reported 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 2a27b123fd catch TooManyRedirects in safe_mode 2012-05-01 17:00:19 -07:00
Kenneth Reitz d79e1bbaad or str 2012-05-01 07:02:13 -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
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 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
Shivaram Lingamneni b4eb8663af prefer certifi's bundle to the OS bundle 2012-04-22 18:43:59 -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
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
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 365c64fe3b #539 2012-04-10 23:00:25 -03:00
Shrikant Sharat Kandula 5a8a8f2bd3 Add docs on sending lists for multivalued query params. 2012-04-10 14:42:38 +05:30
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 18591920f3 upload data on redirects too 2012-03-30 23:31:19 -04:00
Kenneth Reitz b20d171c1c POST redirect => GET
#269
2012-03-30 23:28:07 -04: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 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 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
Steve Pulec 3c2f52d681 Fixes issues #496 by having Response.ok catch all Requests exceptions. 2012-03-18 23:06:42 -03:00
Kenneth Reitz 9cf9d76eb5 Merge pull request #477 from maxcountryman/develop
potentially fixes #338
2012-03-15 18:15:27 -07:00
Kenneth Reitz 4677ba5cd9 only verify private cert when verity is true 2012-03-14 20:29:30 -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 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 0a1e527aec Merge of maxcountryman 2012-03-09 08:51:03 -08:00