original_docstring: Perform a request to GitHub API v3.
  
          :param uri: API endpoint
          :param payload: data sent to GitHub API remote
          :param method: a string representation of method that should be used
          :param json_response: False for a raw response, no JSON is parsed
          
docstring: Perform a request to GitHub API v3.
docstring_tokens: Perform a request to GitHub API v3 .
code: def _call(cls, uri: str, payload: typing.Union[dict, list] = None, method: str = None, json_response: bool = True):
          """Perform a request to GitHub API v3.
  
          :param uri: API endpoint
          :param payload: data sent to GitHub API remote
          :param method: a string representation of method that should be used
          :param json_response: False for a raw response, no JSON is parsed
          """
          requests_kwargs = {
              'headers': copy.copy(Configuration().headers)
          }
  
          if Configuration().token:
              _LOG.debug("Using OAuth2 token '%s***' for GitHub call", Configuration().token[:4])
              requests_kwargs['headers']['Authorization'] = 'token {!s}'.format(Configuration().token)
          elif Configuration().user:
              if not Configuration().password:
                  raise MissingPassword("No password set for user {!s}".format(Configuration().user))
  
              _LOG.debug("Using basic authentication for user %s", Configuration().user)
              requests_kwargs['auth'].append((Configuration().user, Configuration().password))
          else:
              _LOG.debug("No authentication is used")
  
          url = "{!s}{!s}".format(Configuration().github_api, uri)
          requests_func = getattr(requests, method.lower())
          if payload:
              requests_kwargs['json'] = payload
  
          while True:
              _LOG.debug("%s %s", method, url)
              response = requests_func(url, **requests_kwargs)
  
              _LOG.debug("Request took %s and the HTTP status code for response was %d",
                         response.elapsed, response.status_code)
  
              if not (response.status_code == 403 and
                      response.json()['message'].startswith("API rate limit exceeded") and
                      Configuration().omit_rate_limiting):
                  break
  
              reset_datetime = datetime.fromtimestamp(int(response.headers['X-RateLimit-Reset']))
              sleep_time = (reset_datetime - datetime.now()).total_seconds()
              _LOG.debug("API rate limit hit, retrying in %d seconds...", sleep_time)
              time.sleep(sleep_time)
  
          try:
              # Rely on request's checks here
              response.raise_for_status()
          except requests.exceptions.HTTPError as exc:
              raise HTTPError(response.json(), response.status_code) from exc
  
          if json_response:
              return response.json(), response.headers
          return response.text, response.headers
code_tokens: def _call ( cls , uri : str , payload : typing . Union [ dict , list ] = None , method : str = None , json_response : bool = True ) : requests_kwargs = { 'headers' : copy . copy ( Configuration ( ) . headers ) } if Configuration ( ) . token : _LOG . debug ( "Using OAuth2 token '%s***' for GitHub call" , Configuration ( ) . token [ : 4 ] ) requests_kwargs [ 'headers' ] [ 'Authorization' ] = 'token {!s}' . format ( Configuration ( ) . token ) elif Configuration ( ) . user : if not Configuration ( ) . password : raise MissingPassword ( "No password set for user {!s}" . format ( Configuration ( ) . user ) ) _LOG . debug ( "Using basic authentication for user %s" , Configuration ( ) . user ) requests_kwargs [ 'auth' ] . append ( ( Configuration ( ) . user , Configuration ( ) . password ) ) else : _LOG . debug ( "No authentication is used" ) url = "{!s}{!s}" . format ( Configuration ( ) . github_api , uri ) requests_func = getattr ( requests , method . lower ( ) ) if payload : requests_kwargs [ 'json' ] = payload while True : _LOG . debug ( "%s %s" , method , url ) response = requests_func ( url , ** requests_kwargs ) _LOG . debug ( "Request took %s and the HTTP status code for response was %d" , response . elapsed , response . status_code ) if not ( response . status_code == 403 and response . json ( ) [ 'message' ] . startswith ( "API rate limit exceeded" ) and Configuration ( ) . omit_rate_limiting ) : break reset_datetime = datetime . fromtimestamp ( int ( response . headers [ 'X-RateLimit-Reset' ] ) ) sleep_time = ( reset_datetime - datetime . now ( ) ) . total_seconds ( ) _LOG . debug ( "API rate limit hit, retrying in %d seconds..." , sleep_time ) time . sleep ( sleep_time ) try : response . raise_for_status ( ) except requests . exceptions . HTTPError as exc : raise HTTPError ( response . json ( ) , response . status_code ) from exc if json_response : return response . json ( ) , response . headers return response . text , response . headers
short_docstring: Perform a request to GitHub API v3.
short_docstring_tokens: Perform a request to GitHub API v3 .
comment: """Perform a request to GitHub API v3.
  
          :param uri: API endpoint
          :param payload: data sent to GitHub API remote
          :param method: a string representation of method that should be used
          :param json_response: False for a raw response, no JSON is parsed
          """$SEP$# Rely on request's checks here