Permalink
Browse files

Basic urllib2 based fetcher implementation

  • Loading branch information...
1 parent da4edbb commit 1259e80de9db0307c4fa9d2eac773c8ac4242449 cnanga committed Feb 16, 2009
Showing with 12 additions and 1 deletion.
  1. +12 −1 myspaceid-python-sdk/src/myspace/myspaceapi.py
@@ -174,9 +174,20 @@ def fetch(self, url, debug=False):
print 'server response: %s' % s
return s
-class UrlFetcher():
+class UrlFetcher(object):
"""Implementation of UrlFetch for non-AppEngine envs."""
+ def fetch(self, url, debug=False):
+ req = urllib2.urlopen(url)
+ try:
+ f = urllib2.urlopen(req)
+ response = f.read()
+ except urllib2.URLError, e:
+ response = None
+ return response
+
+class UrlFetcher():
+
def fetch(self, url, debug=False):
rv = urlfetch.fetch(url)
s = rv.content

0 comments on commit 1259e80

Please sign in to comment.