Merge remote-tracking branch 'upstream/develop' into develop
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Chris Dary · committed by Chris Dary · parents e264582, 2f91d8e · Browse files · 10 files·+27 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+27 added−9 removed
- tests:+5 added−1 removed
- other:+22 added−8 removed
Provenance
- Commit
1cf5ec8- Tree
51f7be4- Author
Chris Dary <umbrae@gmail.com>- Committer
Chris Dary <umbrae@gmail.com>- Parent 1
e264582- Parent 2
2f91d8e
10 files changed+27 added−9 removed
modified:requests/__init__.py+2 added-2 removed
13 unmodified lines14 15 """16 17 __title__ = 'requests'18-__version__ = '0.10.6'19-__build__ = 0x00100618+__version__ = '0.10.7'19+__build__ = 0x00100720 __author__ = 'Kenneth Reitz'21 __license__ = 'ISC'22 __copyright__ = 'Copyright 2012 Kenneth Reitz'23 10 unmodified linesmodified:requests/defaults.py+2 added
15 unmodified lines16 :danger_mode: If true, Requests will raise errors immediately.17 :safe_mode: If true, Requests will catch all errors.18 :pool_maxsize: The maximium size of an HTTP connection pool.19 :pool_connections: The number of active HTTP connection pools to use.20+:encode_uri: If true, URIs will automatically be percent-encoded.21 """22 23 SCHEMAS = ['http', 'https']24 15 unmodified lines40 defaults['max_retries'] = 041 defaults['danger_mode'] = False42 defaults['safe_mode'] = False43 defaults['keep_alive'] = True44+defaults['encode_uri'] = True45 46 modified:requests/models.py+7 added-5 removed
63 unmodified lines64 _poolmanager=None,65 verify=None,66 session=None):67 68+ #: Dictionary of configurations for this request.69+ self.config = dict(config or [])70+71 #: Float describes the timeout of the request.72 # (Use socket.setdefaulttimeout() as fallback)73 self.timeout = timeout74 39 unmodified lines114 115 #: CookieJar to attach to :class:`Request <Request>`.116 self.cookies = dict(cookies or [])117 115- #: Dictionary of configurations for this request.116- self.config = dict(config or [])117-118 #: True if Request has been sent.119 self.sent = False120 121 #: Event-handling hooks.199 unmodified lines321 322 if not path:323 path = '/'324 325+326 if is_py2:327 if isinstance(scheme, str):328 scheme = scheme.encode('utf-8')329 if isinstance(netloc, str):14 unmodified lines344 url = '%s&%s' % (url, self._enc_params)345 else:346 url = '%s?%s' % (url, self._enc_params)347 348+ if self.config.get('encode_uri', True):347- url = requote_uri(url)349+ url = requote_uri(url)350 351 return url352 353 @property26 unmodified lines380 381 return self.hooks[event].append(hook)382 383 def send(self, anyway=False, prefetch=False):382- """Sends the request. Returns True of successful, false if not.384+ """Sends the request. Returns True of successful, False if not.385 If there was an HTTPError during transmission,386 self.response.status_code will contain the HTTPError code.387 388 Once a request is successfully sent, `sent` will equal True.412 unmodified linesmodified:requests/sessions.py+3 added
62 unmodified lines63 proxies=None,64 hooks=None,65 params=None,66 config=None,67+ prefetch=False,68 verify=True):69 70 self.headers = headers or {}71 self.cookies = cookies or {}2 unmodified lines74 self.proxies = proxies or {}75 self.hooks = hooks or {}76 self.params = params or {}77 self.config = config or {}78+ self.prefetch = prefetch79 self.verify = verify80 81 for (k, v) in list(defaults.items()):82 self.config.setdefault(k, v)66 unmodified lines149 files = {} if files is None else files150 headers = {} if headers is None else headers151 params = {} if params is None else params152 hooks = {} if hooks is None else hooks153+ prefetch = self.prefetch or prefetch154 155 # use session's hooks as defaults156 for key, cb in list(self.hooks.items()):157 hooks.setdefault(key, cb)143 unmodified linesmodified:tests/test_requests_ext.py+4 added
47 unmodified lines48 utf8_string = (u'Smörgås').encode('utf-8')49 requests.post('http://www.google.com/', data=utf8_string)50 51 52+ def test_unicode_error(self):53+ url = u'http://blip.fm/~1abvfu'54+ requests.get(url)55+56 if __name__ == '__main__':57 unittest.main()58 modified:tests/test_requests.py+1 added-1 removed
72 unmodified lines73 74 def test_path_is_not_double_encoded(self):75 request = requests.Request("http://0.0.0.0/get/test case")76 77- assert request.path_url == "/get/test%20case"77+ self.assertEqual(request.path_url, "/get/test%20case")78 79 def test_HTTP_200_OK_GET(self):80 r = get(httpbin('/get'))81 self.assertEqual(r.status_code, 200)722 unmodified linesadded:.env+1 added
1+workon rmodified:AUTHORS.rst+1 added
82 unmodified lines83 - Cory Benfield (Lukasa)84 - Matt Giuca85 - Adam Tauber86 - Honza Javorek87+- Brendan Maguire <maguire.brendan@gmail.com>modified:HISTORY.rst+5 added
1 History2 -------3 4+0.10.7 (2012-03-07)5++++++++++++++++++++6+7+* `encode_uri` = False8+9 0.10.6 (2012-02-25)10 +++++++++++++++++++11 12 * Allow '=' in cookies.396 unmodified linesmodified:README.rst+1 added-1 removed
1 Requests: HTTP for Humans2 =========================3 4-.. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=master4+.. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop5 6 Requests is an ISC Licensed HTTP library, written in Python, for human7 beings.8 68 unmodified lines