kennethreitz/requests — Issue #420: request.get('www.httpbin.org') throws error
Author: kracekumar
Created: 2012-02-11 16:10:15+00:00
State: open

In [2]: r = requests.get("www.httpbin.org")
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/kracekumar/ in ()
----> 1 r = requests.get("www.httpbin.org")

/usr/local/lib/python2.7/dist-packages/requests/api.pyc in get(url, **kwargs)
78
79 kwargs.setdefault('allow_redirects', True)
---> 80 return request('get', url, **kwargs)
81
82

/usr/local/lib/python2.7/dist-packages/requests/api.pyc in request(method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, return_response, prefetch, session, config)
65 return_response=return_response,
66 config=config,
---> 67 prefetch=prefetch
68 )
69

/usr/local/lib/python2.7/dist-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, return_response, config, prefetch)
189
190 # Send the HTTP Request.

--> 191 r.send(prefetch=prefetch)
192
193 # Send any cookies back up the to the session.

/usr/local/lib/python2.7/dist-packages/requests/models.pyc in send(self, anyway, prefetch)
345
346 # Build the URL

--> 347 url = self.full_url
348
349 # Logging

/usr/local/lib/python2.7/dist-packages/requests/models.pyc in full_url(self)
288
289 if not scheme:
--> 290 raise ValueError()
291
292 netloc = netloc.encode('idna')

ValueError:

This is kinda frustrating since `protocol` isn't menthioned underlying `urllib` is throwing error. So it would be awesome if `www.xyz.com` is converted to `http://www.xyz.com`.