gidgethub — Exceptions


exception gidgethub.GitHubException[source]

Base exception for this library.

exception gidgethub.ValidationFailure[source]

An exception representing failed validation of a webhook event.

Inherits from GitHubException.

exception gidgethub.HTTPException(status_code, *args)[source]

A general exception to represent HTTP responses. Inherits from GitHubException. The status_code is expected to be an http.HTTPStatus enum value.


The http.HTTPStatus status code that the exception represents.

exception gidgethub.RedirectionException[source]

Exception for 3XX HTTP responses.

Inherits from HTTPException.

exception gidgethub.BadRequest[source]

Exception for 4XX HTTP responses.

Inherits from HTTPException.

exception gidgethub.BadRequestUnknownError[source]

Exception for 422 status code responses which do not include a JSON response.

New in version XXX.


The response as returned by GitHub.

exception gidgethub.RateLimitExceeded(rate_limit)[source]

Raised when one’s rate limit has been reached. A subclass of BadRequest.

New in version 2.0.


The RateLimit object with the rate limit details which triggered the raising of the exception.

exception gidgethub.InvalidField(errors, *args)[source]

Raised when a field in a request is invalid.

Inherits from BadRequest and explicitly specifies a 422 status code. Details of what fields were invalid are stored in the errors attribute.


A list of error details for each field which was invalid.

exception gidgethub.ValidationError(errors, *args)[source]

A request was unable to be completed.

Inherits from BadRequest a 422 HTTP response.


Error details.

exception gidgethub.GitHubBroken[source]

An exception representing 5XX HTTP responses.

Inherits from HTTPException.


exception gidgethub.GraphQLException(message, response)[source]

Base exception for all GraphQL-related exceptions.

Inherits from GitHubException.


The decoded JSON response from GitHub.

exception gidgethub.BadGraphQLRequest(status_code, response)[source]

A 4XX HTTP response to a GraphQL request.

Inherits from GraphQLException.


The decoded JSON response from GitHub.

exception gidgethub.GraphQLAuthorizationFailure(response)[source]

A 401 HTTP response due to an authorization failure.

Inherits from BadGraphQLRequest.

exception gidgethub.QueryError(response)[source]

An exception representing an error relating to the GraphQL query itself.

Inherits from GraphQLException.

exception gidgethub.GraphQLResponseTypeError(content_type, response)[source]

An exception raised when a GraphQL query response is not JSON.

Inherits from GraphQLException.


The value of the content-type header in the response from GitHub.


The decoded response value from GitHub.