gipea


Namegipea JSON
Version 0.11.2 PyPI version JSON
download
home_pagehttps://github.com/AthAshino/gipea
SummaryA gitea python API wrapper
upload_time2024-01-05 09:35:54
maintainer
docs_urlNone
authorAshino
requires_python>=3.10,<4.0
licenseMIT
keywords gitea api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gipea

A very simple API client for Gitea > 1.16.1

Note that not the full Swagger-API is accessible. The whole implementation is focused
on making access and working with Organizations, Teams, Repositories and Users as pain
free as possible.

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

## Usage

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

```python
from gitea import *

gitea = Gitea(URL, TOKEN)
```

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

```python
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.

```python
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.

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

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.

```python
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.

```python
org.delete()
```

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

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

## Installation

Use ``pip install gipea`` to install.

## Tests

Tests can be run with:

```make test```

The default server credentials that will be used are:
url = `http://localhost:3000` and admin-user token located in `.token`.

These parameters can be overwritten with the env variables:
GITEA_URL
GITEA_TOKEN

The admin user must be named ``test``, with email ``secondarytest@test.org``.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AthAshino/gipea",
    "name": "gipea",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "gitea,api",
    "author": "Ashino",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/3b/50/34d36706a9802976bc573f0e4f0345a121ad38687bef07d7ea3c4f056ec3/gipea-0.11.2.tar.gz",
    "platform": null,
    "description": "# gipea\n\nA very simple API client for Gitea > 1.16.1\n\nNote that not the full Swagger-API is accessible. The whole implementation is focused\non making access and working with Organizations, Teams, Repositories and Users as pain\nfree as possible.\n\nOriginally forked from https://github.com/Langenfeld/py-gitea.\n\n## Usage\n\nFirst get a `gitea` object wrapping access and authentication (via an api token) for your gitea instance:\n\n```python\nfrom gitea import *\n\ngitea = Gitea(URL, TOKEN)\n```\n\nOperations like requesting the Gitea version or authentication user can be requested directly from the `gitea` object:\n\n```python\nprint(\"Gitea Version: \" + gitea.get_version())\nprint(\"API-Token belongs to user: \" + gitea.get_user().username)\n```\n\nAdding entities like Users, Organizations, ... also is done via the gitea object.\n\n```python\nuser = gitea.create_user(\"Test Testson\", \"test@test.test\", \"password\")\n```\n\nAll operations on entities in gitea are then accomplished via the according wrapper objects for those entities.\nEach of those objects has a `.request` method that creates an entity according to your gitea instance.\n\n```python\nother_user = User.request(gitea, \"OtherUserName\")\nprint(other_user.username)\n```\n\nNote that the fields of the User, Organization,... classes are dynamically created at runtime, and thus not visible\nduring divelopment. Refer to the Gitea-API documentation for the fields names.\n\nFields that can not be altered via gitea-api, are read only. After altering a field, the `.commit` method of the\naccording object must be called to synchronize the changed fields with your gitea instance.\n\n```python\norg = Organization.request(gitea, test_org)\norg.description = \"some new description\"\norg.location = \"some new location\"\norg.commit()\n```\n\nAn entity in gitea can be deleted by calling delete.\n\n```python\norg.delete()\n```\n\nAll entity objects do have methods to execute some of the requests possible though the gitea-api:\n\n```python\norg = Organization.request(gitea, ORGNAME)\nteams = org.get_teams()\nfor team in teams:\n    repos = team.get_repos()\n    for repo in repos:\n        print(repo.name)\n```\n\n## Installation\n\nUse ``pip install gipea`` to install.\n\n## Tests\n\nTests can be run with:\n\n```make test```\n\nThe default server credentials that will be used are:\nurl = `http://localhost:3000` and admin-user token located in `.token`.\n\nThese parameters can be overwritten with the env variables:\nGITEA_URL\nGITEA_TOKEN\n\nThe admin user must be named ``test``, with email ``secondarytest@test.org``.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A gitea python API wrapper",
    "version": "0.11.2",
    "project_urls": {
        "Homepage": "https://github.com/AthAshino/gipea",
        "Repository": "https://github.com/AthAshino/gipea"
    },
    "split_keywords": [
        "gitea",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4ae79f7734e53f0d97d39db004ff88576e7b03d8ca0daa3cf6125452a5c79db",
                "md5": "de86b49ffbda104d50fa36dc73d9c86e",
                "sha256": "ace0504aae1eeab48c305fade15f2b0a616ec115dcf70421846190caf5b9a160"
            },
            "downloads": -1,
            "filename": "gipea-0.11.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "de86b49ffbda104d50fa36dc73d9c86e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 18120,
            "upload_time": "2024-01-05T09:35:53",
            "upload_time_iso_8601": "2024-01-05T09:35:53.024502Z",
            "url": "https://files.pythonhosted.org/packages/b4/ae/79f7734e53f0d97d39db004ff88576e7b03d8ca0daa3cf6125452a5c79db/gipea-0.11.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b5034d36706a9802976bc573f0e4f0345a121ad38687bef07d7ea3c4f056ec3",
                "md5": "cdc6a27460586a896a1fc964bd4be4f5",
                "sha256": "2ba2482fd89b562b8847b64ea13fe2d62dfef1b6c40ea675fc8c12623cc943fa"
            },
            "downloads": -1,
            "filename": "gipea-0.11.2.tar.gz",
            "has_sig": false,
            "md5_digest": "cdc6a27460586a896a1fc964bd4be4f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 17090,
            "upload_time": "2024-01-05T09:35:54",
            "upload_time_iso_8601": "2024-01-05T09:35:54.588626Z",
            "url": "https://files.pythonhosted.org/packages/3b/50/34d36706a9802976bc573f0e4f0345a121ad38687bef07d7ea3c4f056ec3/gipea-0.11.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-05 09:35:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AthAshino",
    "github_project": "gipea",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gipea"
}
        
Elapsed time: 0.36138s