Skip to content

Commit

Permalink
Basic urllib2 based fetcher implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
cnanga committed Feb 16, 2009
1 parent da4edbb commit 1259e80
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion myspaceid-python-sdk/src/myspace/myspaceapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1259e80

Please sign in to comment.