Skip to content

gitea.client

client

Client for Gitea API.

Classes

gitea.client.AsyncGitea

AsyncGitea(
    token: str | None = None,
    base_url: str = "https://gitea.com",
)

Bases: Client

Asynchronous Gitea API client.

Initialize the asynchronous Gitea client.

Parameters:

Name Type Description Default
token str | None

The API token for authentication.

None
base_url str

The base URL of the Gitea instance.

'https://gitea.com'
Source code in src/gitea/client/async_gitea.py
def __init__(self, token: str | None = None, base_url: str = "https://gitea.com") -> None:
    """Initialize the asynchronous Gitea client.

    Args:
        token: The API token for authentication.
        base_url: The base URL of the Gitea instance.

    """
    from gitea.actions.async_actions import AsyncActions  # noqa: PLC0415
    from gitea.comment.async_comment import AsyncComment  # noqa: PLC0415
    from gitea.issue.async_issue import AsyncIssue  # noqa: PLC0415
    from gitea.label.async_label import AsyncLabel  # noqa: PLC0415
    from gitea.milestone.async_milestone import AsyncMilestone  # noqa: PLC0415
    from gitea.notification.async_notification import AsyncNotification  # noqa: PLC0415
    from gitea.organization.async_organization import AsyncOrganization  # noqa: PLC0415
    from gitea.project.async_project import AsyncProject  # noqa: PLC0415
    from gitea.pull_request.async_pull_request import AsyncPullRequest  # noqa: PLC0415
    from gitea.repository import AsyncRepository  # noqa: PLC0415
    from gitea.user.async_user import AsyncUser  # noqa: PLC0415

    super().__init__(token=token, base_url=base_url)
    self.session: ClientSession | None = None

    # Resource handlers
    self.actions = AsyncActions(client=self)
    self.issue = AsyncIssue(client=self)
    self.pull_request = AsyncPullRequest(client=self)
    self.repository = AsyncRepository(client=self)
    self.user = AsyncUser(client=self)
    self.comment = AsyncComment(client=self)
    self.label = AsyncLabel(client=self)
    self.milestone = AsyncMilestone(client=self)
    self.notification = AsyncNotification(client=self)
    self.project = AsyncProject(client=self)
    self.organization = AsyncOrganization(client=self)

gitea.client.Gitea

Gitea(
    token: str | None = None,
    base_url: str = "https://gitea.com",
)

Bases: Client

Synchronous Gitea API client.

Initialize the Gitea client.

Parameters:

Name Type Description Default
token str | None

The API token for authentication.

None
base_url str

The base URL of the Gitea instance.

'https://gitea.com'
Source code in src/gitea/client/gitea.py
def __init__(self, token: str | None = None, base_url: str = "https://gitea.com") -> None:
    """Initialize the Gitea client.

    Args:
        token: The API token for authentication.
        base_url: The base URL of the Gitea instance.

    """
    from gitea.actions.actions import Actions  # noqa: PLC0415
    from gitea.comment.comment import Comment  # noqa: PLC0415
    from gitea.issue.issue import Issue  # noqa: PLC0415
    from gitea.label.label import Label  # noqa: PLC0415
    from gitea.milestone.milestone import Milestone  # noqa: PLC0415
    from gitea.notification.notification import Notification  # noqa: PLC0415
    from gitea.organization.organization import Organization  # noqa: PLC0415
    from gitea.project.project import Project  # noqa: PLC0415
    from gitea.pull_request.pull_request import PullRequest  # noqa: PLC0415
    from gitea.repository.repository import Repository  # noqa: PLC0415
    from gitea.user.user import User  # noqa: PLC0415

    super().__init__(token=token, base_url=base_url)
    self.session: requests.Session | None = None

    # Resource handlers
    self.actions = Actions(client=self)
    self.issue = Issue(client=self)
    self.pull_request = PullRequest(client=self)
    self.repository = Repository(client=self)
    self.user = User(client=self)
    self.comment = Comment(client=self)
    self.label = Label(client=self)
    self.milestone = Milestone(client=self)
    self.notification = Notification(client=self)
    self.project = Project(client=self)
    self.organization = Organization(client=self)

Functions:

Modules