This function sets up a very simple logging configuration (log everything on standard output) that is useful for troubleshooting.

Error Handling

exception github.GithubException.GithubException(status, data)

Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub (but github.GithubException.BadAttributeException).

Some other types of exceptions might be raised by underlying libraries, for example for network-related issues.


The status returned by the Github API


The (decoded) data returned by the Github API

exception github.GithubException.BadCredentialsException(status, data)

Exception raised in case of bad credentials (when Github API replies with a 401 or 403 HTML status)

exception github.GithubException.UnknownObjectException(status, data)

Exception raised when a non-existing object is requested (when Github API replies with a 404 HTML status)

exception github.GithubException.BadUserAgentException(status, data)

Exception raised when request is sent with a bad user agent header (when Github API replies with a 403 bad user agent HTML status)

exception github.GithubException.RateLimitExceededException(status, data)

Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML status)

exception github.GithubException.BadAttributeException(actualValue, expectedType, transformationException)

Exception raised when Github returns an attribute with the wrong type.


The value returned by Github


The type PyGithub expected


The exception raised when PyGithub tried to parse the value

exception github.GithubException.TwoFactorException(status, data)

Exception raised when Github requires a onetime password for two-factor authentication

exception github.GithubException.IncompletableObject(status, data)

Exception raised when we can not request an object from Github because the data returned did not include a URL

Default argument

github.NotSet is a special value for arguments you don’t want to provide. You should not have to manipulate it directly, because it’s the default value of all parameters accepting it. Just note that it is different from None, which is an allowed value for some parameters.

Input classes

class github.InputFileContent.InputFileContent(content, new_name=NotSet)

This class represents InputFileContents

  • content – string
  • new_name – string
class github.InputGitAuthor.InputGitAuthor(name, email, date=NotSet)

This class represents InputGitAuthors

  • name – string
  • email – string
  • date – string
class github.InputGitTreeElement.InputGitTreeElement(path, mode, type, content=NotSet, sha=NotSet)

This class represents InputGitTreeElements

  • path – string
  • mode – string
  • type – string
  • content – string
  • sha – string or None