From: Cory Benfield Date: Wed, 8 Aug 2012 11:05:52 +0000 (+0100) Subject: Accept objects with string representations as URLs. X-Git-Tag: v0.13.7~14^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6166ba7e131ef77f9748488a02dc5e699928a17d;p=services%2Fpython-requests.git Accept objects with string representations as URLs. --- diff --git a/requests/models.py b/requests/models.py index d8c0f3e..20a2880 100644 --- a/requests/models.py +++ b/requests/models.py @@ -71,7 +71,14 @@ class Request(object): 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 `. self.headers = dict(headers or [])