Пример #1
0
 def build_api_client(self, oauth_params=None):
   if oauth_params is not None:
     http = oauth_wrap.get_authorised_http(oauth_params)
     return apiclient.discovery.build('buzz', 'v1', http=http, 
       developerKey=self.api_key)
   else:
     return apiclient.discovery.build('buzz', 'v1', developerKey=self.api_key)
Пример #2
0
def fetch(url):
  logging.debug('Now fetching: %s' % url)
  
  path = os.path.expanduser('~/.oacurl.properties')
  if not os.path.exists(path):
    logging.debug('User is not logged in.')
    
    print 'You are not logged in'
    sys.exit(1)

  properties = load_properties_file(path)
  oauth_parameters = {
    'consumer_key': properties['consumerKey'], 
    'consumer_secret' : properties['consumerSecret'],
    'oauth_token' : properties['accessToken'],
    'oauth_token_secret':properties['accessTokenSecret']}
  
  http = oauth_wrap.get_authorised_http(oauth_parameters)
  response, content = http.request(url)
  logging.debug(response)
  logging.debug(content)
  
  return response,content
Пример #3
0
 def build_api_client(self, oauth_params=None):
   if oauth_params is not None:
     http = oauth_wrap.get_authorised_http(oauth_params)
     return apiclient.discovery.build('buzz', 'v1', http = http)
   else:
     return apiclient.discovery.build('buzz', 'v1')