Skip to content

Commit

Permalink
Accept objects with string representations as URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa committed Aug 8, 2012
1 parent e624ae8 commit 6166ba7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ def __init__(self,
self.timeout = timeout

#: Request URL.
self.url = url
#: Accept objects that have string representations.
try:
self.url = unicode(url)
except NameError:
# We're on Python 3.
self.url = str(url)
except UnicodeDecodeError:
self.url = url

#: Dictionary of HTTP Headers to attach to the :class:`Request <Request>`.
self.headers = dict(headers or [])
Expand Down

0 comments on commit 6166ba7

Please sign in to comment.