Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also catch HTTPErrors when opening url. #8

Merged
merged 1 commit into from Sep 24, 2012
Merged

Also catch HTTPErrors when opening url. #8

merged 1 commit into from Sep 24, 2012

Conversation

benkonrath
Copy link
Contributor

HttpErrors float through when running with PyPy 1.9. This patch should fix the problem.

Here's a trace of the problem with youtube url:

https://www.youtube.com/watch?v=Z3IsAaLtO_4

    oembed_data = providers.request(self.url)
  File "/var/lib/jenkins/jobs/legacydb/workspace/env/src/micawber/micawber/providers.py", line 82, in inner
    return fn(self, url, **params)
  File "/var/lib/jenkins/jobs/legacydb/workspace/env/src/micawber/micawber/providers.py", line 108, in request
    return provider.request(url, **params)
  File "/var/lib/jenkins/jobs/legacydb/workspace/env/src/micawber/micawber/providers.py", line 57, in request
    response = self.fetch(endpoint_url)
  File "/var/lib/jenkins/jobs/legacydb/workspace/env/src/micawber/micawber/providers.py", line 29, in fetch
    resp = urllib2.urlopen(req)
  File "/var/lib/jenkins/jobs/legacydb/workspace/pypy-1.9/lib-python/2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/var/lib/jenkins/jobs/legacydb/workspace/pypy-1.9/lib-python/2.7/urllib2.py", line 400, in open
    response = meth(req, response)
  File "/var/lib/jenkins/jobs/legacydb/workspace/pypy-1.9/lib-python/2.7/urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "/var/lib/jenkins/jobs/legacydb/workspace/pypy-1.9/lib-python/2.7/urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "/var/lib/jenkins/jobs/legacydb/workspace/pypy-1.9/lib-python/2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/var/lib/jenkins/jobs/legacydb/workspace/pypy-1.9/lib-python/2.7/urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 401: Unauthorized

Thanks! Ben

coleifer added a commit that referenced this pull request Sep 24, 2012
Also catch HTTPErrors when opening url.
@coleifer coleifer merged commit a3e4d49 into coleifer:master Sep 24, 2012
@coleifer
Copy link
Owner

Thanks for this!

@benkonrath
Copy link
Contributor Author

No problem. Thanks for a great Django app. Any chance you can cut a maintenance release (0.2.5) with this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants