Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
umbrae committed Mar 8, 2012
2 parents e264582 + 2f91d8e commit 1cf5ec8
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workon r
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ Patches and Suggestions
- Matt Giuca
- Adam Tauber
- Honza Javorek
- Brendan Maguire <maguire.brendan@gmail.com>
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
History
-------

0.10.7 (2012-03-07)
+++++++++++++++++++

* `encode_uri` = False

0.10.6 (2012-02-25)
+++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Requests: HTTP for Humans
=========================

.. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=master
.. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop

Requests is an ISC Licensed HTTP library, written in Python, for human
beings.
Expand Down
4 changes: 2 additions & 2 deletions requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""

__title__ = 'requests'
__version__ = '0.10.6'
__build__ = 0x001006
__version__ = '0.10.7'
__build__ = 0x001007
__author__ = 'Kenneth Reitz'
__license__ = 'ISC'
__copyright__ = 'Copyright 2012 Kenneth Reitz'
Expand Down
2 changes: 2 additions & 0 deletions requests/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:safe_mode: If true, Requests will catch all errors.
:pool_maxsize: The maximium size of an HTTP connection pool.
:pool_connections: The number of active HTTP connection pools to use.
:encode_uri: If true, URIs will automatically be percent-encoded.
"""

SCHEMAS = ['http', 'https']
Expand All @@ -40,5 +41,6 @@
defaults['danger_mode'] = False
defaults['safe_mode'] = False
defaults['keep_alive'] = True
defaults['encode_uri'] = True


12 changes: 7 additions & 5 deletions requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def __init__(self,
verify=None,
session=None):

#: Dictionary of configurations for this request.
self.config = dict(config or [])

#: Float describes the timeout of the request.
# (Use socket.setdefaulttimeout() as fallback)
self.timeout = timeout
Expand Down Expand Up @@ -112,9 +115,6 @@ def __init__(self,
#: CookieJar to attach to :class:`Request <Request>`.
self.cookies = dict(cookies or [])

#: Dictionary of configurations for this request.
self.config = dict(config or [])

#: True if Request has been sent.
self.sent = False

Expand Down Expand Up @@ -322,6 +322,7 @@ def full_url(self):
if not path:
path = '/'


if is_py2:
if isinstance(scheme, str):
scheme = scheme.encode('utf-8')
Expand All @@ -344,7 +345,8 @@ def full_url(self):
else:
url = '%s?%s' % (url, self._enc_params)

url = requote_uri(url)
if self.config.get('encode_uri', True):
url = requote_uri(url)

return url

Expand Down Expand Up @@ -379,7 +381,7 @@ def register_hook(self, event, hook):
return self.hooks[event].append(hook)

def send(self, anyway=False, prefetch=False):
"""Sends the request. Returns True of successful, false if not.
"""Sends the request. Returns True of successful, False if not.
If there was an HTTPError during transmission,
self.response.status_code will contain the HTTPError code.
Expand Down
3 changes: 3 additions & 0 deletions requests/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self,
hooks=None,
params=None,
config=None,
prefetch=False,
verify=True):

self.headers = headers or {}
Expand All @@ -74,6 +75,7 @@ def __init__(self,
self.hooks = hooks or {}
self.params = params or {}
self.config = config or {}
self.prefetch = prefetch
self.verify = verify

for (k, v) in list(defaults.items()):
Expand Down Expand Up @@ -148,6 +150,7 @@ def request(self, method, url,
headers = {} if headers is None else headers
params = {} if params is None else params
hooks = {} if hooks is None else hooks
prefetch = self.prefetch or prefetch

# use session's hooks as defaults
for key, cb in list(self.hooks.items()):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_invalid_url(self):
def test_path_is_not_double_encoded(self):
request = requests.Request("http://0.0.0.0/get/test case")

assert request.path_url == "/get/test%20case"
self.assertEqual(request.path_url, "/get/test%20case")

def test_HTTP_200_OK_GET(self):
r = get(httpbin('/get'))
Expand Down
4 changes: 4 additions & 0 deletions tests/test_requests_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def test_binary_post(self):
requests.post('http://www.google.com/', data=utf8_string)


def test_unicode_error(self):
url = u'http://blip.fm/~1abvfu'
requests.get(url)

if __name__ == '__main__':
unittest.main()

0 comments on commit 1cf5ec8

Please sign in to comment.