Client

class aiogithub.GitHub(token: str = None, items_per_page=100, timeout_secs=10, max_paginated_items=1000, enable_preview_api=False)

Initialises a GitHub API client.

If no personal access token is provided, the client will check the GITHUB_TOKEN environment variable for a token and use that if present. If still without a token, the GitHub API will be used unauthenticated.

Parameters:
  • token – GitHub personal access token
  • items_per_page – Items to request per page, must be between 1 and 100
  • timeout_secs – Timeout in seconds for HTTP requests
  • max_paginated_items – Safety limit for when iterating through list results to avoid inadvertently making a huge number of requests
coroutine close() → None
coroutine get_branch(owner_name, repo_name, branch_name) → aiogithub.objects.branch.Branch

Gets a single branch of a repository.

coroutine get_current_user() → aiogithub.objects.user.AuthenticatedUser

Gets the current authenticated user.

coroutine get_issue(owner_name, repo_name, issue_number) → aiogithub.objects.issue.Issue

Gets a single issue of a repository.

coroutine get_organization(username, defer_fetch=False) → aiogithub.objects.organization.Organization

Gets a single organization.

Parameters:
  • username – The username/login of the organization to fetch the details of.
  • defer_fetch – Whether to defer fetching of data about this organization.
Returns:

An object representing the organization.

coroutine get_pull_request(owner_name, repo_name, issue_number) → aiogithub.objects.pull_request.PullRequest

Gets a single pull request of a repository.

coroutine get_rate_limit() → aiogithub.objects.rate_limit.RateLimit

Gets the current rate limit values.

coroutine get_repo(owner_name, repo_name, defer_fetch=False) → aiogithub.objects.repo.Repo

Gets a single repository.

Parameters:
  • owner_name – The name of the user or organisation that owns the repository.
  • repo_name – The name of the repository.
  • defer_fetch – Whether to defer fetching of data about this repository.
Returns:

An object representing the repository.

get_repos(since=None) → aiogithub.objects.response.PaginatedListProxy[aiogithub.objects.repo.Repo][aiogithub.objects.repo.Repo]

Gets all repos.

coroutine get_user(username, defer_fetch=False) → aiogithub.objects.user.User

Gets a single user.

Parameters:
  • username – The name of the user to fetch the details of.
  • defer_fetch – Whether to defer fetching of data about this user.
Returns:

An object representing the user.

get_users(since=None) → aiogithub.objects.response.PaginatedListProxy[aiogithub.objects.user.User][aiogithub.objects.user.User]

Gets all users.

last_rate_limit

The rate limits that were sent by GitHub in the most recent request.

Type:Optional[dict]