コード例 #1
0
ファイル: graphapi.py プロジェクト: AlexUlrich/digsby
 def _do_call(self, endpoint, method, callback=None, **k):
     k = prepare_args(k)
     if self.access_token:
         k['access_token'] = self.access_token.encode('utf8')
     url = UrlQuery(self.graph_http + endpoint + '/' + method, **k)
     log.info("calling method: %s", method)
     log.info_s("calling: %s with %r", url, k)
     if self.mode == 'async':
         return self.call_asynchttp(url, None, callback=callback)
     elif self.mode == 'console':
         return call_urllib2(url, None)
     elif self.mode == 'threaded':
         from util.threads import threaded
         return threaded(call_urllib2)(url, None, callback=callback)
     else:
         return callback_adapter(call_urllib2)(url, None, callback=callback)
コード例 #2
0
ファイル: graphapi.py プロジェクト: sgricci/digsby
 def _do_call(self, endpoint, method, callback=None, **k):
     k = prepare_args(k)
     if self.access_token:
         k['access_token'] = self.access_token.encode('utf8')
     url = UrlQuery(self.graph_http + endpoint + '/' + method, **k)
     log.info("calling method: %s", method)
     log.info_s("calling: %s with %r", url, k)
     if self.mode == 'async':
         return self.call_asynchttp(url, None, callback=callback)
     elif self.mode == 'console':
         return call_urllib2(url, None)
     elif self.mode == 'threaded':
         from util.threads import threaded
         return threaded(call_urllib2)(url, None, callback=callback)
     else:
         return callback_adapter(call_urllib2)(url, None, callback=callback)
コード例 #3
0
ファイル: graphapi.py プロジェクト: AlexUlrich/digsby
 def batch(self, *a, **k):
     callback = k.pop('callback')
     k['batch'] = list(a)
     k = prepare_args(k)
     if self.access_token:
         k['access_token'] = self.access_token.encode('utf-8')
     url = UrlQuery(self.graph_http + self.graph_endpoint)
     data = self.prepare_values(k)
     if self.mode == 'async':
         return self.call_asynchttp(url, data, callback=callback)
     elif self.mode == 'console':
         return call_urllib2(url, data)
     elif self.mode == 'threaded':
         from util.threads import threaded
         return threaded(call_urllib2)(url, data, callback=callback)
     else:
         return callback_adapter(call_urllib2)(url, data, callback=callback)
コード例 #4
0
ファイル: graphapi.py プロジェクト: sgricci/digsby
 def batch(self, *a, **k):
     callback = k.pop('callback')
     k['batch'] = list(a)
     k = prepare_args(k)
     if self.access_token:
         k['access_token'] = self.access_token.encode('utf-8')
     url = UrlQuery(self.graph_http + self.graph_endpoint)
     data = self.prepare_values(k)
     if self.mode == 'async':
         return self.call_asynchttp(url, data, callback=callback)
     elif self.mode == 'console':
         return call_urllib2(url, data)
     elif self.mode == 'threaded':
         from util.threads import threaded
         return threaded(call_urllib2)(url, data, callback=callback)
     else:
         return callback_adapter(call_urllib2)(url, data, callback=callback)