code: def retrieve_authorization_code(self, redirect_func=None):
          
          
          request_param = {
              "client_id": self.client_id,
              "redirect_uri": self.redirect_uri,
              }
  
          if self.scope:
              request_param['scope'] = self.scope
  
          if self._extra_auth_params:
              request_param.update(self._extra_auth_params)
  
          r = requests.get(self.auth_uri, params=request_param,
                           allow_redirects=False)
          url = r.headers.get('location') 
          if self.local:
              webbrowser.open_new_tab(url)
              authorization_code = raw_input("Code: ")
              if self.validate_code(authorization_code):
                  self.authorization_code = authorization_code
          else:
              return redirect_func(url)
docs: retrieve authorization code to get access token