<commit_before>import webbrowser
from rauth import OAuth1Service

class YahooOAuth(object):
  '''OAuth for yahoo api
  '''

  def __init__(self, consumer_key= None, consumer_secret= None, base_url= None):
    '''
    '''
    self.consumer_key = consumer_key
    self.consumer_secret = consumer_secret
    self.base_url = base_url

    self.oauth = OAuth1Service(
      consumer_key = consumer_key,
      consumer_secret = consumer_secret,
      name = 'yahoo',
      request_token_url = "https://api.login.yahoo.com/oauth/v2/get_request_token",
      access_token_url = "https://api.login.yahoo.com/oauth/v2/get_token",
      authorize_url = "https://api.login.yahoo.com/oauth/v2/request_auth",
      base_url = 'https://query.yahooapis.com/v1/public/yql'
    )

    self.oauth_params {
      # 'oauth_consumer_key' : '<KEY>',
      'oauth_nonce' : uuid4().hex,
      'oauth_timestamp': time.time(),
      'oauth_signature_method' : 'plaintext',
      'oauth_signature' : '98407bfba41094aacd571e971fe82c9c7c1cfe60%26',
      'oauth_version' : 1.0,
      'oauth_callback' : 'oob'
    }


  def get_request_token(self,):
    '''Requests access_token and access secrets
    '''

    self.request_token, self.request_token_secret = self.oauth.get_request_token(params= self.oauth_params)

    return self.request_token, self.request_token_secret

  def authorize_url(self,):
    '''Redirects to the authorization url
    '''

    url = self.oauth.get_authorize_url(self.request_token)

    webbrowser.open(str(url))

    verifier = raw_input('Please input the verifier : ')

    return verifier

  <commit_msg>updates #12: fetching access_token<commit_after>import webbrowser
from rauth import OAuth1Service

class YahooOAuth(object):
  '''OAuth for yahoo api
  '''

  def __init__(self, consumer_key= None, consumer_secret= None, base_url= None):
    '''
    '''
    self.consumer_key = consumer_key
    self.consumer_secret = consumer_secret
    self.base_url = base_url

    self.service = OAuth1Service(
      consumer_key = consumer_key,
      consumer_secret = consumer_secret,
      name = 'yahoo',
      request_token_url = "https://api.login.yahoo.com/oauth/v2/get_request_token",
      access_token_url = "https://api.login.yahoo.com/oauth/v2/get_token",
      authorize_url = "https://api.login.yahoo.com/oauth/v2/request_auth",
      base_url = 'https://query.yahooapis.com/v1/public/yql'
    )

    self.params {
      # 'oauth_consumer_key' : '<KEY>',
      'oauth_nonce' : uuid4().hex,
      'oauth_timestamp': time.time(),
      'oauth_signature_method' : 'plaintext',
      'oauth_signature' : '98407bfba41094aacd571e971fe82c9c7c1cfe60%26',
      'oauth_version' : 1.0,
      'oauth_callback' : 'oob'
    }


  def get_request_token(self,):
    '''Requests access_token and access secrets
    '''

    self.request_token, self.request_token_secret = self.service.get_request_token(params= self.params)

    return self.request_token, self.request_token_secret

  def get_user_authorization(self,):
    '''Redirects to the authorization url
    '''

    url = self.service.get_authorize_url(self.request_token)

    webbrowser.open(str(url))

    self.verifier = raw_input('Please input the verifier : ')

    return self.verifier

  def get_access_token(self,):
    '''Get oauth_token
    '''

    self.access_token, self.access_token_secret = self.oauth.get_access_toke(self.token, self.token_secret, params={'oauth_verifer': self.verifier})

    return self.access_token, self.access_token_secret


  def refresh_token(self):
    '''Refresh the access_token
    '''
    pass
    
{'fraction_non_alphanumeric': 0.1204785754034502, 'fraction_numerical': 0.019476905954368393, 'mean_word_length': 3.5796178343949046, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3477356', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1223, 'n_words': 198}