Commit Graph

120 Commits

Author SHA1 Message Date
Kamil Madac 8aff6f5ed0 Redesigned no_proxy ip range imlementation to use only stdlib functions 2013-12-03 16:23:08 +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
Samuel Hug a501b0ca81 Fix for AppEngine 2013-10-28 09:51:56 -07: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
Kenneth Reitz 54ad646067 merge 2.0 insto master 2013-09-24 14:13:28 -04: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 f040b2aa5d Allow spaces in the no_proxy environ variable. 2013-08-23 12:37:03 +01:00
Cory Benfield 5a26241287 Better percent-escape exception. 2013-08-02 12:29:23 +01:00
Kenneth Reitz f865d61713 Merge branch 'proxyscheme' of git://github.com/Lukasa/requests into 2.0 2013-07-31 21:27:01 -04: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
Cory Benfield 840540b6b1 Proxy urls should have explicit schemes. 2013-07-28 07:16:06 +01:00
Chen Huang 9083735963 @1434 Fix https://github.com/kennethreitz/requests/issues/1434 2013-06-25 18:38:59 -04: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
Chase Sterling 98114245c6 Refactor merge_kwargs for clarity and to fix a few bugs 2013-05-20 21:20:51 -04: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
schlamar 59f916ca4a Use streaming decompression feature of urllib3. 2013-04-10 08:08:33 +02: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
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
Cory Benfield d437c338d0 Add Proxy-Auth header when proxies have credentials. 2013-02-06 18:40:35 +00:00
Christopher Bare 9ff8cbe5fb shorten filename by os.path.basename in guess_filename(obj) 2013-01-30 15:33:43 -08:00
oczkers 40a060cf57 it`s more pep8 now 2013-01-27 02:04:12 +01: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 ef8563ab36 CHUNKED REQUESTS! 2013-01-10 01:58:29 -05:00
Cory Benfield 641f4611b2 Make sure proxies have their scheme attached. 2012-12-27 13:37:36 +00:00
Shivaram Lingamneni bbea679ab2 clean up code support for OS certificate bundles 2012-12-23 02:40:18 -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
Kenneth Reitz c3431bb6f2 tension 2012-12-17 07:01:59 -05:00
Kenneth Reitz cc4b0b110f further remove config 2012-12-17 03:08:25 -05: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
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
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
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
Pavel Dmitriev a02f3dec02 Fix for user-agent setting 2012-11-13 17:40:13 +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
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
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 820dfb0495 Making the code more PEP8 compliant 2012-10-09 00:42:49 +03:00
Kunal Mehta 4f9e552148 Use __iter__ rather than the inefficient nested for loops 2012-10-09 00:42:48 +03: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
Rhys Elsmore f3159ed4f6 Added in a link handler as per issue #711 2012-08-21 00:47:19 +10: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
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
Sævar Öfjörð Magnússon 350be4a549 Appengine workaround 2012-07-25 16:06:26 +00:00
Donald Stufft 21f60fe8df Move the user agent generation into it's own utility function 2012-07-08 00:47:24 -04: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 c3ad7af06c include certifi 2012-06-28 15:58:00 -07:00