code: def request_token(self, parser=None, redirect_uri=None, **kwargs):
          
          kwargs = kwargs and kwargs or {}
  
          parser = parser or _default_parser
          kwargs.update({
              'client_id': self.client_id,
              'client_secret': self.client_secret,
              'grant_type': 'grant_type' in kwargs and kwargs['grant_type'] or \
                  'authorization_code'
          })
          if redirect_uri is not None:
              kwargs.update({'redirect_uri': redirect_uri})
  
          # TODO: maybe raise an exception here if status code isn't 200?
          msg = urlopen(self.token_endpoint, urlencode(kwargs).encode(
              'utf-8'))
          data = parser(msg.read().decode(msg.info().get_content_charset() or
              'utf-8'))
  
          for key in data:
              setattr(self, key, data[key])
  
          # expires_in is RFC-compliant. if anything else is used by the
          # provider, token_expires must be set manually
          if hasattr(self, 'expires_in'):
              try:
                  # python3 dosn't support long
                  seconds = long(self.expires_in)
              except:
                  seconds = int(self.expires_in)
              self.token_expires = mktime((datetime.utcnow() + timedelta(
                  seconds=seconds)).timetuple())
docs: Request an access token from the token endpoint.
          This is largely a helper method and expects the client code to
          understand what the server expects. Anything that's passed into
          ``**kwargs`` will be sent (``urlencode``d) to the endpoint. Client
          secret and client ID are automatically included, so are not required
          as kwargs. For example::
  
              # if requesting access token from auth flow:
              {
                  'code': rval_from_auth,
              }
  
              # if refreshing access token:
              {
                  'refresh_token': stored_refresh_token,
                  'grant_type': 'refresh_token',
              }
  
          :param parser: Callback to deal with returned data. Not all providers
                         use JSON.