Skip to content

keys

Accessed as client.repos.keys; the async client mirrors it.

ReposKeys

The repos.keys namespace.

create

create(owner: str, repo: str, *, key: str, read_only: bool | None = None, title: str) -> DeployKey

Add a key to a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
key str

An armored SSH key to add

required
read_only bool | None

Describe if the key has only read access or read/write

None
title str

Title of the key to add

required

Returns:

Type Description
DeployKey

DeployKey.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoCreateKey

delete

delete(owner: str, repo: str, id: int) -> None

Delete a key from a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of the key to delete

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDeleteKey

get

get(owner: str, repo: str, id: int) -> DeployKey

Get a repository's key by id.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of the key to get

required

Returns:

Type Description
DeployKey

DeployKey.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetKey

list

list(
    owner: str,
    repo: str,
    *,
    key_id: int | None = None,
    fingerprint: str | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> Paginated[DeployKey]

List a repository's keys.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
key_id int | None

the key_id to search for

None
fingerprint str | None

fingerprint of the key

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
Paginated[DeployKey]

DeployKeyList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListKeys

AsyncReposKeys

The repos.keys namespace.

create

create(owner: str, repo: str, *, key: str, read_only: bool | None = None, title: str) -> DeployKey

Add a key to a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
key str

An armored SSH key to add

required
read_only bool | None

Describe if the key has only read access or read/write

None
title str

Title of the key to add

required

Returns:

Type Description
DeployKey

DeployKey.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoCreateKey

delete

delete(owner: str, repo: str, id: int) -> None

Delete a key from a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of the key to delete

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDeleteKey

get

get(owner: str, repo: str, id: int) -> DeployKey

Get a repository's key by id.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id int

id of the key to get

required

Returns:

Type Description
DeployKey

DeployKey.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetKey

list

list(
    owner: str,
    repo: str,
    *,
    key_id: int | None = None,
    fingerprint: str | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> AsyncPaginated[DeployKey]

List a repository's keys.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
key_id int | None

the key_id to search for

None
fingerprint str | None

fingerprint of the key

None
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
AsyncPaginated[DeployKey]

DeployKeyList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListKeys