Commit Graph

152 Commits

Author SHA1 Message Date
Ian Cordasco d505b94fa4 Add DeprecationWarnings to inform users of plans
After a long discussion in IRC and on several issues, the developers of
requests have decided to remove specific functions from requests.utils
in version 3.0.0. To give users ample time to prepare for this, we've
added DeprecationWarnings long in advance. See also the planning of this
in issue #2266.
2014-10-26 19:24:41 -05:00
Michael DeLay 8339b60fd5 Made more better 2014-10-10 09:58:30 -07:00
mikecool1000 ce1ac88543 Fixed #2250 2014-10-09 12:22:18 -07:00
mikecool1000 4594667f07 Update utils.py
Fixed -2250
2014-10-08 19:26:07 -07:00
kennethreitz 5850b1f53b Merge pull request #2249 from t-8ch/fix_2247
fix #2247
2014-10-05 13:19:14 -04:00
Kenneth Reitz 79f56e2e7e fix documentation for utils.get_unicode_from_response() :) 2014-10-05 13:14:38 -04:00
Thomas Weißschuh 6e1db21733 fix #2247
We have to pass urllib3 the url without the authentication information,
else it will be parsed by httplib as a netloc and included in the request line
and Host header
2014-09-25 19:49:28 +00:00
Kevin Burke 59f5a1089a add trailing comma 2014-08-29 12:06:58 -07:00
Kenneth Reitz d33ce49aaa keep-alive 2014-08-28 13:05:30 -04:00
kennethreitz c023f06aad Merge pull request #1924 from schlamar/proxy-default-scheme
Default proxy scheme to HTTP
2014-05-12 15:05:56 -04:00
Pavlo Kapyshin 4ca4865170 Fix typo 2014-04-10 06:09:41 +03:00
kennethreitz fe4c4f1461 Merge pull request #1951 from Lukasa/proxyauth
Re-evaluate proxy authorization.
2014-03-23 10:51:48 -04:00
Cory Benfield 6d7e8a97bb Split get_environ_proxies into two methods.
This makes it possible to get at the no_proxy logic separately.
2014-03-12 19:20:12 +00:00
schlamar a59fac5e4b Removed compress from accepted encodings. 2014-03-12 12:11:55 +01:00
schlamar 780ce3902e Revert "Proxy urls should have explicit schemes."
This reverts commit 840540b6b1.

Conflicts:
	requests/adapters.py
	requests/utils.py
2014-02-18 15:15:36 +01:00
Cory Benfield 2f98ef1792 Be less defensive in get_auth_from_url. 2014-01-12 14:44:53 +00:00
Cory Benfield b4ca6c95b6 Meet @sigmavirus24's demanding stylistic criteria. 2014-01-12 09:39:32 +00:00
Cory Benfield dddb41e349 TypeError, not AttributeError on 3.3. 2014-01-11 10:15:53 +00:00
Cory Benfield ca187abd13 Unquote the auth after splitting the url. 2014-01-11 09:59:23 +00:00
kennethreitz 14f207f3fc Merge pull request #1846 from acdha/paranoid-get_netrc_auth
get_netrc_auth should handle os.path.expanduser failing
2014-01-08 10:57:09 -08:00
Chris Adams a80bd7708d get_netrc_auth: code cleanup
* Stop iterating as soon as we find a netrc file
* More obvious return None
2014-01-07 12:23:11 -05:00
Chris Adams 0b41cec7a4 get_netrc_auth: handle os.path.expanduser failure
os.path.expanduser can raise a KeyError when $HOME is not set and the
POSIX getpwuid() call fails, which can happen when running under a UID
which is not in /etc/passwd or when the password file cannot be read.

The upstream bug report http://bugs.python.org/issue20164 is unlikely to
be backported to Python 2.x even if fixed so this change handles
KeyError by skipping netrc authentication.

Closes #1846
2014-01-07 11:34:51 -05:00
Cory Benfield e2a36dda0a Don't let proxy_bypass bring you down. 2014-01-07 09:37:59 +00:00
kennethreitz ba3dab5047 Merge pull request #1770 from kmadac/master
Implemetation of IP address ranges for no_proxy environment variable
2013-12-05 14:40:44 -08:00
Cory Benfield 57c138e59b Remove the unicode literals. 2013-12-05 21:06:11 +00:00
Kamil Madac 1d42d9d274 function is_ipv4_network renamed
more detailed check of cidr format
2013-12-05 11:15:52 +01:00
Kamil Madac f3bc8b6e1f Typo fixed 2013-12-05 09:36:49 +01:00
Kamil Madac 21c88c829a Broad exception fixed 2013-12-05 09:32:29 +01:00
kracekumar 6c1be607f1 Made default_user_agent reusable
This is not exciting change, but will help for people who wants to change name of user agent alone. Also name can be unicode.
2013-12-05 12:11:35 +05:30
Kamil Madac 59b29d02f8 Tiny comment fix 2013-12-04 15:11:10 +01:00
Kamil Madac 947248129b Better comments 2013-12-04 11:47:40 +01:00
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
Cory Benfield e2961b9f91 Unquote the URL before extracting the auth. 2013-12-01 10:29:14 +00: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