diff options
| author | alecflett <alecflett@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2> | 2008-06-23 18:32:33 +0000 |
|---|---|---|
| committer | alecflett <alecflett@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2> | 2008-06-23 18:32:33 +0000 |
| commit | 584e770449ceb88a71dbb9867c20196f8a6188b7 (patch) | |
| tree | 43380144ca3d6cbb4e5489e0e6a8978a9ca4f5a3 /freebase-api/freebase/api/httpclients.py | |
| parent | 81489f6da826ff56de04405b1d07a247d9ade491 (diff) | |
fix urllib2 implementation
git-svn-id: http://freebase-python.googlecode.com/svn/trunk@45 5914aa95-5b3a-0410-a3b5-7b719e7fe9b2
Diffstat (limited to 'freebase-api/freebase/api/httpclients.py')
| -rw-r--r-- | freebase-api/freebase/api/httpclients.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/freebase-api/freebase/api/httpclients.py b/freebase-api/freebase/api/httpclients.py index c2b10b2..3375113 100644 --- a/freebase-api/freebase/api/httpclients.py +++ b/freebase-api/freebase/api/httpclients.py @@ -12,13 +12,18 @@ except: try: import urllib2 + import socket except: pass +import logging +import re + class Urllib2Client(object): def __init__(self, cookiejar): cookiespy = urllib2.HTTPCookieProcessor(cookiejar) self.opener = urllib2.build_opener(cookiespy) + self.log = logging.getLogger() def __call__(self, url, method, body, headers): req = urllib2.Request(url, body, headers) @@ -31,6 +36,7 @@ class Urllib2Client(object): raise MetawebError, 'failed contacting %s: %s' % (url, str(e)) except urllib2.HTTPError, e: + self.log.error('HTTP ERROR: %s', e) self._raise_service_error(url, e.code, e.info().type, e.fp.read()) for header in resp.info().headers: |
