Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GAE 1.1.9 related changes:

Removing AppEngine specific fetcher since GAE started supporting urllib2 fetchers in 1.1.9
  • Loading branch information...
commit f4a6d37e333939ffd86ad97a6777ce4361230966 1 parent d9a0e38
cnanga authored
Showing with 3 additions and 25 deletions.
  1. +3 −25 myspaceid-python-sdk/src/myspace/myspaceapi.py
View
28 myspaceid-python-sdk/src/myspace/myspaceapi.py
@@ -1,10 +1,6 @@
import httplib
import sys
import urllib2
-try:
- from google.appengine.api import urlfetch
-except:
- pass
import exceptions
import simplejson
from oauthlib import oauth
@@ -30,11 +26,6 @@
API_VIDEOS_URL = 'http://api.myspace.com/v1/users/%s/videos.json'
API_VIDEO_URL = 'http://api.myspace.com/v1/users/%s/videos/%s.json'
-def get_default_urlfetcher():
- if sys.modules.has_key('google.appengine.api.urlfetch'):
- return AppEngineUrlFetcher()
- return UrlFetcher()
-
class MySpaceError(Exception):
def __init__(self, value):
self.value = value
@@ -51,7 +42,7 @@ def __init__(self, consumer_key, consumer_secret, oauth_token_key=None, oauth_to
self.token = oauth.OAuthConsumer(oauth_token_key, oauth_token_secret)
else:
self.token = None
- self.url_fetcher = get_default_urlfetcher()
+ self.url_fetcher = UrlFetcher()
"""OAuth Related functions
"""
@@ -163,22 +154,9 @@ def __call_myspace_api(self, api_url, parameters=None, debug=False):
api_response = simplejson.loads(json)
return api_response
-class AppEngineUrlFetcher():
- """Implementation of UrlFetch using AppEngine's URLFetch API."""
-
- def fetch(self, url, debug=False):
- rv = urlfetch.fetch(url)
- s = rv.content
- if debug:
- print 'requested url: %s' % url
- print 'server response: %s' % s
- return s
-
class UrlFetcher(object):
- """Implementation of UrlFetch for non-AppEngine envs."""
-
- def fetch(self, url, debug=False):
- req = urllib2.urlopen(url)
+ def fetch(self, url, body=None, headers=None, debug=False):
+ req = urllib2.Request(url)
try:
f = urllib2.urlopen(req)
response = f.read()
Please sign in to comment.
Something went wrong with that request. Please try again.