Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Handling invalid URL scheme #5

Open
karlcow opened this issue Aug 16, 2012 · 0 comments
Open

Handling invalid URL scheme #5

karlcow opened this issue Aug 16, 2012 · 0 comments
Labels

Comments

@karlcow
Copy link
Owner

karlcow commented Aug 16, 2012

When accessing speedtest.net with an Android mobile user agent, the site decides to redirect automatically to the mobile application store.

market://speedtest.net

This would not work. We have to test that the uri has a valid scheme before trying to access the resource.

Traceback (most recent call last):
  File "survey/core.py", line 319, in <module>
    main()
  File "survey/core.py", line 271, in main
    htmltext, finaluri = req.getContent(uri, UAREF)
  File "survey/core.py", line 68, in getContent
    r = requests.get(uri, headers=headers)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 54, in get
    return request('get', url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/safe_mode.py", line 37, in wrapped
    return function(method, url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 42, in request
    return s.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 230, in request
    r.send(prefetch=prefetch)
  File "/Library/Python/2.7/site-packages/requests/models.py", line 609, in send
    self._build_response(r)
  File "/Library/Python/2.7/site-packages/requests/models.py", line 296, in _build_response
    request.send()
  File "/Library/Python/2.7/site-packages/requests/models.py", line 465, in send
    url = self.full_url
  File "/Library/Python/2.7/site-packages/requests/models.py", line 377, in full_url
    raise InvalidSchema("Invalid scheme %r" % scheme)
requests.exceptions.InvalidSchema: Invalid scheme 'market'
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant