Commit Graph

328 Commits

Author SHA1 Message Date
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 cf82d4406b Update tests to work offline 2014-12-01 16:21:41 -06:00
Ian Cordasco 2eb7e3c80b Add last few changes and add a quick test 2014-11-12 13:56:28 -06:00
Alexander Nelzin 34f6088c8f Added test for overriding Content-Length. 2014-11-12 15:23:23 +03:00
Ian Cordasco 29ef108158 Use to_native_string instead of builtin_str
Fixes #2316
2014-10-31 21:20:04 -05:00
Scott Sadler 583859b820 fix failing test "test_prepare_unicode_url" \(take 3\) 2014-10-26 14:45:12 +01: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
kennethreitz 1e79cf6a47 Merge pull request #2258 from willingc/add-json
Add json parameter
2014-10-05 12:46:09 -04:00
Joe Alcorn a68d1b4517 Support bytestring URLs on Python 3.x 2014-09-30 19:29:10 +01:00
Daniel Hahler bff8b91638 Document skipping in PreparedRequest; followup to #2222 2014-09-12 18:07:28 +02: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
Ian Cordasco ce7957c085 Add test for invalid port 2014-08-29 16:50:45 -05:00
Kevin Burke 2c76122a48 Add test that invalid domain raises a ConnectionError 2014-08-29 14:07:28 -07:00
Carol Willing 0713e09526 Fixes typo in test 2014-08-28 19:42:21 -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
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 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
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
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
Josh Schneier 47d0517d66 handle urllib3 api changes; closes #2045 2014-07-29 23:29:21 -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
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
Cory Benfield d977ee8a24 Force basic auth strings to native string type 2014-06-08 10:20:32 +01:00
David Gouldin 32f600b083 Allow copying of PreparedRequests without headers/cookies 2014-05-30 10:11:53 -07: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
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
kennethreitz 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
Feng Liu 24819e8aae support request tuple data
rewrite the TestModels

Ajust the code
2014-03-27 10:41:49 +08: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
kennethreitz 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
kennethreitz 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
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
Jason R. Coombs 7b378cb742 Add tests for decode_unicode 2014-03-04 17:46:58 -05:00
kennethreitz d8557a2627 Merge pull request #1935 from cjstapleton/master
Add timeout to stream with testing
2014-03-03 13:14:37 -05: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 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
Zack Weinberg 0caa243212 New Response property, .is_redirect. 2014-02-13 14:27:42 -05:00
Konstantinos Koukopoulos b6e16799d0 test pyopenssl redirect (unit test for #1887) 2014-01-28 09:08:16 -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
Cory Benfield ca187abd13 Unquote the auth after splitting the url. 2014-01-11 09:59:23 +00:00