Skip to content

API

pycodecov.api

Codecov

Bases: API

Base Codecov API wrapper.

get_service_owners(service, page=None, page_size=None) async

Get a paginated list of owners to which the currently authenticated user has access.

Parameters:

Name Type Description Default
service Service

git hosting service provider.

required
page int | None

a page number within the paginated result set.

None
page_size int | None

number of results to return per page.

None

Returns:

Type Description
PaginatedListApi[Owner]

Paginated list of Owner.

Examples:

>>> import asyncio
>>> import os
>>> from pycodecov import Codecov
>>> from pycodecov.enums import Service
>>> async def main():
...     async with Codecov(os.environ["CODECOV_API_TOKEN"]) as codecov:
...         service_owners = await codecov.get_service_owners(Service.GITHUB)
...         print(service_owners)
>>> asyncio.run(main())
PaginatedListApi(...)

Owner

Bases: API, Owner

Owner API Wrapper from Codecov API.

get_detail() async

Get a single owner by name.

Returns:

Type Description
Owner

An Owner.

Examples:

>>> import asyncio
>>> import os
>>> from pycodecov import Codecov
>>> from pycodecov.enums import Service
>>> async def main():
...     async with Codecov(os.environ["CODECOV_API_TOKEN"]) as codecov:
...         service_owners = await codecov.get_service_owners(Service.GITHUB)
...         for service_owner in service_owners:
...             print(await service_owner.get_detail())
>>> asyncio.run(main())
Owner(...)
...

get_users(activated=None, is_admin=None, page=None, page_size=None, search=None) async

Get a paginated list of users for the specified owner (org).

Parameters:

Name Type Description Default
activated bool | None

whether the user has been manually deactivated.

None
is_admin bool | None

whether the user is admin.

None
page int | None

a page number within the paginated result set.

None
page_size int | None

number of results to return per page.

None
search str | None

a search term.

None

Returns:

Type Description
PaginatedListApi[User]

Paginated list of User.

Examples:

>>> import asyncio
>>> import os
>>> from pycodecov import Codecov
>>> from pycodecov.enums import Service
>>> async def main():
...     async with Codecov(os.environ["CODECOV_API_TOKEN"]) as codecov:
...         service_owners = await codecov.get_service_owners(Service.GITHUB)
...         for service_owner in service_owners:
...             print(await service_owner.get_users())
>>> asyncio.run(main())
PaginatedListApi(...)

PaginatedList

Bases: API, PaginatedList[T]

Paginated list API Wrapper from Codecov API.

PaginatedListApi

Bases: API, PaginatedList[T]

Paginated list API Wrapper from Codecov API.

User

Bases: API, User

User API Wrapper from Codecov API.

get_detail() async

Get a user for the specified owner_username or ownerid.

Returns:

Type Description
User

A User.

Examples:

>>> import asyncio
>>> import os
>>> from pycodecov import Codecov
>>> from pycodecov.enums import Service
>>> async def main():
...     async with Codecov(os.environ["CODECOV_API_TOKEN"]) as codecov:
...         service_owners = await codecov.get_service_owners(Service.GITHUB)
...         for service_owner in service_owners:
...             users = await service_owner.get_users()
...             for user in users:
...                 print(await user.get_detail())
>>> asyncio.run(main())
User(...)
...