Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class API:
- def __init__(self, key):
- self.header = dict(apikey=key)
- def call(self, method, params):
- request = urllib2.Request(
- self.url + method[0] + '/' + method[1],
- urllib.urlencode(params),
- self.header
- )
- try:
- response = json.loads(urllib2.urlopen(request).read())
- return response
- except urllib2.HTTPError as error:
- return dict(Error=str(error))
Add Comment
Please, Sign In to add comment