Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Also catch HTTPErrors when opening url. #8

merged 1 commit into from over 1 year ago

2 participants

Ben Konrath Charles Leifer
Ben Konrath

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:

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

Thanks! Ben

Charles Leifer coleifer merged commit a3e4d49 into from September 23, 2012
Charles Leifer coleifer closed this September 23, 2012
Charles Leifer

Thanks for this!

Ben Konrath

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

Showing 1 unique commit by 1 author.

Sep 23, 2012
Ben Konrath Also catch HTTPErrors when opening url. 12b1ab7
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  micawber/
2  micawber/
@@ -29,6 +29,8 @@ def fetch(self, url):
29 29
             resp = urllib2.urlopen(req)
30 30
         except urllib2.URLError:
31 31
             return False
+        except urllib2.HTTPError:
+            return False
32 34
         except socket.timeout:
33 35
             return False
34 36

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.