def oauth_get(self, resource, consumer, token, param=None, callback=None): url = self._get_url(resource, param) client = ClientAlpha(consumer, token) if callback: client.set_callback(callback) resp, content = client.request(url, "GET") # print resource # try: # s = json.dumps(json.loads(content),indent=4,ensure_ascii=False) # print s.encode('utf8') # except: # pass return resp, content
def oauth_post(self, resource, consumer, token, param={}, callback=None): url = URL_PREFIX + resource client = ClientAlpha(consumer, token) if callback: client.set_callback(callback) body = urllib.urlencode(param) resp, content = client.request(url, "POST", body=body) # print resource # try: # s = json.dumps(json.loads(content),indent=4,ensure_ascii=False) # print s.encode('utf8') # except Exception as e: # print e return resp, content
def oauth_delete(self, resource, consumer, token): url = URL_PREFIX + resource client = ClientAlpha(consumer, token) resp, content = client.request(url, "DELETE") return resp, content