gerrit.utils package
Submodules
gerrit.utils.common module
- gerrit.utils.common.decode_response(response: Any) Any[source]
Strip off Gerrit’s magic prefix and decode a response. :returns:
Decoded JSON content as a dict, or raw text if content could not be decoded as JSON.
- Raises:
requests.HTTPError if the response contains an HTTP error status code.
gerrit.utils.exceptions module
Module for custom exceptions.
Where possible we try to throw exceptions with non-generic, meaningful names.
- exception gerrit.utils.exceptions.AccountAlreadyExistsError[source]
Bases:
GerritAPIExceptionAccount already exists
- exception gerrit.utils.exceptions.AccountEmailAlreadyExistsError[source]
Bases:
GerritAPIExceptionAccount Email already exists
- exception gerrit.utils.exceptions.AccountEmailNotFoundError[source]
Bases:
GerritAPIExceptionAccount Email cannot be found
- exception gerrit.utils.exceptions.AccountNotFoundError[source]
Bases:
GerritAPIExceptionAccount cannot be found
- exception gerrit.utils.exceptions.AuthError[source]
Bases:
GerritAPIException403 Forbidden is returned if the operation is not allowed because the calling user does not have sufficient permissions.
- exception gerrit.utils.exceptions.BranchAlreadyExistsError[source]
Bases:
GerritAPIExceptionBranch already exists
- exception gerrit.utils.exceptions.BranchNotFoundError[source]
Bases:
GerritAPIExceptionBranch cannot be found
- exception gerrit.utils.exceptions.ChangeEditNotFoundError[source]
Bases:
GerritAPIExceptionChange edit cannot be found
- exception gerrit.utils.exceptions.ChangeNotFoundError[source]
Bases:
GerritAPIExceptionChange cannot be found
- exception gerrit.utils.exceptions.ClientError[source]
Bases:
GerritAPIExceptionClient Error
- exception gerrit.utils.exceptions.CommitNotFoundError[source]
Bases:
GerritAPIExceptionCommit cannot be found
- exception gerrit.utils.exceptions.ConflictError[source]
Bases:
GerritAPIException409 Conflict is returned if the request cannot be completed because the current state of the resource doesn’t allow the operation.
- exception gerrit.utils.exceptions.FileContentNotFoundError[source]
Bases:
GerritAPIExceptionFile content not found
- exception gerrit.utils.exceptions.GPGKeyNotFoundError[source]
Bases:
GerritAPIExceptionGPG key cannot be found
- exception gerrit.utils.exceptions.GerritAPIException[source]
Bases:
ExceptionBase class for all errors
- exception gerrit.utils.exceptions.GroupAlreadyExistsError[source]
Bases:
GerritAPIExceptionGroup already exists
- exception gerrit.utils.exceptions.GroupMemberAlreadyExistsError[source]
Bases:
GerritAPIExceptionGroup member already exists
- exception gerrit.utils.exceptions.GroupMemberNotFoundError[source]
Bases:
GerritAPIExceptionGroup member cannot be found
- exception gerrit.utils.exceptions.GroupNotFoundError[source]
Bases:
GerritAPIExceptionGroup cannot be found
- exception gerrit.utils.exceptions.NotAllowedError[source]
Bases:
GerritAPIException405 Method Not Allowed is returned if the resource exists but doesn’t support the operation.
- exception gerrit.utils.exceptions.NotFoundError[source]
Bases:
GerritAPIExceptionResource cannot be found
- exception gerrit.utils.exceptions.ProjectAlreadyExistsError[source]
Bases:
GerritAPIExceptionProject already exists
- exception gerrit.utils.exceptions.ProjectNotFoundError[source]
Bases:
GerritAPIExceptionProject cannot be found
- exception gerrit.utils.exceptions.ReviewerAlreadyExistsError[source]
Bases:
GerritAPIExceptionReviewer already exists
- exception gerrit.utils.exceptions.ReviewerNotFoundError[source]
Bases:
GerritAPIExceptionReviewer cannot be found
- exception gerrit.utils.exceptions.SSHKeyNotFoundError[source]
Bases:
GerritAPIExceptionSSH key cannot be found
- exception gerrit.utils.exceptions.ServerError[source]
Bases:
GerritAPIExceptionServer Error
- exception gerrit.utils.exceptions.TagAlreadyExistsError[source]
Bases:
GerritAPIExceptionTag already exists
- exception gerrit.utils.exceptions.TagNotFoundError[source]
Bases:
GerritAPIExceptionTag cannot be found
- exception gerrit.utils.exceptions.UnauthorizedError[source]
Bases:
GerritAPIException401 Unauthorized
- exception gerrit.utils.exceptions.UnknownBranch[source]
Bases:
KeyError,NotFoundErrorGerrit does not recognize the branch requested.
- exception gerrit.utils.exceptions.UnknownFile[source]
Bases:
KeyError,NotFoundErrorGerrit does not recognize the revision file requested.
- exception gerrit.utils.exceptions.UnknownTag[source]
Bases:
KeyError,NotFoundErrorGerrit does not recognize the tag requested.
- exception gerrit.utils.exceptions.ValidationError[source]
Bases:
GerritAPIException400 Bad Request is returned if the request is not understood by the server due to malformed syntax. E.g. 400 Bad Request is returned if JSON input is expected but the ‘Content-Type’ of the request
is not ‘application/json’ or the request body doesn’t contain valid JSON.
400 Bad Request is also returned if required input fields are not set or if options are set which cannot be used together.
gerrit.utils.gerritbase module
gerrit.utils.requester module
- class gerrit.utils.requester.Requester(**kwargs: Any)[source]
Bases:
objectA class which carries out HTTP requests. You can replace this class with one of your own implementation if you require some other way to access Gerrit. This default class can handle simple authentication only.
- AUTH_COOKIE: str | None = None
- VALID_STATUS_CODES: List[int] = [200]
- delete(url: str, headers: Dict[str, str] | None = None, allow_redirects: bool = True, raise_for_status: bool = True, **kwargs: Any) Response[source]
- Parameters:
url
headers
allow_redirects
raise_for_status
kwargs
- Returns:
- get(url: str, params: Dict[str, Any] | List[Tuple[str, Any]] | None = None, headers: Dict[str, str] | None = None, allow_redirects: bool = True, stream: bool = False, raise_for_status: bool = True, **kwargs: Any) Response[source]
- Parameters:
url
params
headers
allow_redirects
stream
raise_for_status
kwargs
- Returns:
- get_request_dict(params: Dict[str, Any] | List[Tuple[str, Any]] | None = None, data: Any | None = None, json: Any | None = None, headers: Dict[str, str] | None = None, **kwargs: Any) Dict[str, Any][source]
- Parameters:
params
data
json
headers
kwargs
- Returns:
- post(url: str, params: Dict[str, Any] | List[Tuple[str, Any]] | None = None, data: Any | None = None, json: Any | None = None, files: Any | None = None, headers: Dict[str, str] | None = None, allow_redirects: bool = True, raise_for_status: bool = True, **kwargs: Any) Response[source]
- Parameters:
url
params
data
json
files
headers
allow_redirects
raise_for_status
kwargs
- Returns:
- put(url: str, params: Dict[str, Any] | List[Tuple[str, Any]] | None = None, data: Any | None = None, json: Any | None = None, files: Any | None = None, headers: Dict[str, str] | None = None, allow_redirects: bool = True, raise_for_status: bool = True, **kwargs: Any) Response[source]
- Parameters:
url
params
data
json
files
headers
allow_redirects
raise_for_status
kwargs
- Returns: