Commit Graph

414 Commits

Author SHA1 Message Date
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 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 c8b2f7a37b Update docs to reflect use of params
Resolves issue #917.
2012-11-16 23:05:35 +00: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
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
Jonathan Halcrow 724a3889bc Make sure that url has fragment removed when using a proxy 2012-10-27 09:54:31 -04: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 aa08f33f98 Merge pull request #884 from everbird/develop
Support CJK parameters when post files
2012-10-17 07:21:39 -07:00
Radu Voicilas 820dfb0495 Making the code more PEP8 compliant 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
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
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
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
Ian Cordasco 4dd3d1a1a2 Fix #785 & add regression test. 2012-09-20 11:45:03 -04:00
Kenneth Reitz d70964a608 Merge pull request #848 from barberj/develop
None is not iterable
2012-09-12 10:58:20 -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 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
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
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
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
Cory Benfield 751e7a0a66 Do not post None values in data. 2012-08-22 22:33:25 +01: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
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 489ce1c8a9 Merge pull request #779 from Lukasa/develop
Make sure proxy exclusions work properly.
2012-08-18 17:40:53 -07: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
Locker537 42d0a2169e Whitespace fixes following PEP8. 2012-08-16 17:38:35 -04:00
Cory Benfield 00b4ca3b74 Don't get hung up on ports in proxies. 2012-08-15 18:16:27 +01:00
Cory Benfield 79d53d3b8a Throw InvalidURL not UnicodeError on bad label. 2012-08-13 21:18:56 +01: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 a65e8b4a22 Merge pull request #767 from stefanp/develop
Wrap socket.error in ConnectionError (+ unit tests)
2012-08-08 13:23:10 -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
Ian Cordasco ceec572cb9 Merge branch 'develop' into key_val_lists
Conflicts:
    requests/models.py
2012-08-07 12:11:15 -04: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
Cory Benfield 55bf436f8f Correctly handle encoding numbers when POSTing. 2012-08-06 17:40:27 +01: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