Skip to main content

py-gitea

A simple API client for Gitea > 1.24 based on the idea that passing around dictionaries and strings is disgusting and needs to be wrapped in something safe. So, the whole implementation is focused on making access and working with Organizations, Teams, Repositories and Users as pain free as possible.

Most functions should be covered by tests or should be in use (somewhere) so things should work as expected. Note that not the full Swagger-API is accessible.

Originally forked from https://github.com/m301/py-gitea.

Usage

First get a gitea object wrapping access and authentication (via an api token) for your gitea instance:

from gitea import *

gitea = Gitea(URL, TOKEN)

Operations like requesting the Gitea version or authentication user can be done directly from the gitea object:

print("Gitea Version: " + gitea.get_version())
print("API-Token belongs to user: " + gitea.get_user().username)

Adding entities like Users, Organizations, ... also is done via the gitea object.

user = gitea.create_user("Test Testson", "test@test.test", "password")

All operations on entities in gitea are then accomplished via the according wrapper objects for those entities. Each of those objects has a .request method that creates an entity according to your gitea instance

other_user = User.request(gitea, "OtherUserName")
print(other_user.username)

or can be requested from other entities.

orgs = user.get_orgs()
print(f"{user.name} is in orgarnisations {orgs}")

Note that the fields of the User, Organization,... classes are dynamically created at runtime, and thus not visible during divelopment. Refer to the Gitea-API documentation for the fields names.

Fields that can not be altered via gitea-api, are read only. After altering a field, the .commit method of the according object must be called to synchronize the changed fields with your gitea instance.

org = Organization.request(gitea, test_org)
org.description = "some new description"
org.location = "some new location"
org.commit()

An entity in gitea can be deleted by calling delete.

org.delete()

All entity objects do have methods to execute some of the requests possible though the gitea-api:

org = Organization.request(gitea, ORGNAME)
teams = org.get_teams()
for team in teams:
    repos = team.get_repos()
    for repo in repos:
        print(repo.name)

If something is missing, feel free to add it :).

Installation

Use pip install py-gitea to install.

Tests

Tests can be run with:

python3 -m pytest test_api.py

Make sure to have a gitea-instance running on http://localhost:3000, and an admin-user token at .token. The admin user must be named test, with email secondarytest@test.org.

Metadata

Release files for py-gitea 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-gitea 1.0.1
File Size Uploaded Provenance Actions
py_gitea-1.0.1.tar.gz 26.7 kB With provenance Details for py_gitea-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-gitea 1.0.1
File Interpreter ABI Platform Actions
py_gitea-1.0.1-py3-none-any.whl Python 3 none any Details for py_gitea-1.0.1-py3-none-any.whl

Total release size: 47.4 kB

Release files / py_gitea-1.0.1.tar.gz

Download URL py_gitea-1.0.1.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
456080ffe702d5e42cf4795bb3f122c4e1a29ff72afaaf45994f94661eba0714
BLAKE2b-256 checksum
How to use checksums
8abf33bf82cc428bd883faea0069ab95b5ac56328ce689c5ed5809fb9517b4fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / py_gitea-1.0.1-py3-none-any.whl

Download URL py_gitea-1.0.1-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05ac4791e8fce38c2242b0d9cda9e4c1a968e45a6bbb759da00ffb86a3ad6b38
BLAKE2b-256 checksum
How to use checksums
d28c2ec0f4cbb0c532ad23357df45d9d72055c1704a56c0c34926a872daf0f35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for py-gitea 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_gitea-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page