pyoutlineapi


Namepyoutlineapi JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryA Python package to interact with the Outline VPN Server API
upload_time2024-09-01 17:08:51
maintainerNone
docs_urlNone
authorDenis Rozhnovskiy
requires_python>=3.10
licenseMIT
keywords outline vpn api manager wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyOutlineAPI

`pyoutlineapi` is a Python package designed to interact with the Outline VPN Server API, providing robust data
validation through Pydantic models. This ensures reliable and secure API interactions, making it an excellent choice for
integrating with bots and other automated systems that require accurate and secure communication.

[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=orenlab_pyoutlineapi&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=orenlab_pyoutlineapi)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=orenlab_pyoutlineapi&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=orenlab_pyoutlineapi)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=orenlab_pyoutlineapi&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=orenlab_pyoutlineapi)
[![tests](https://github.com/orenlab/pyoutlineapi/actions/workflows/python_tests.yml/badge.svg)](https://github.com/orenlab/pyoutlineapi/actions/workflows/python_tests.yml)

## Features

- **Server Management**: Retrieve server information, update hostnames, manage ports, and more.
- **Access Key Management**: Create, list, rename, and delete access keys, as well as set data limits.
- **Metrics**: Enable or disable metrics sharing and retrieve data transfer metrics.
- **Experimental Endpoints**: Access and manage experimental features of the Outline Server API.

## Quick Start

To get started with `pyoutlineapi`, follow these steps:

1. Install the package using pip or Poetry.
2. Initialize the `PyOutlineWrapper` client with your Outline VPN server URL and certificate fingerprint.
3. Use the provided methods to interact with the server and access keys.

See the examples below for more detailed information.

## Installation

You can install PyOutlineAPI via [PyPI](https://pypi.org/project/pyoutlineapi/) using pip:

```bash
pip install pyoutlineapi
```

Or via [Poetry](https://python-poetry.org/):

```bash
poetry add pyoutlineapi
```

## Basic Operations

### Initialize the Client

```python
from pyoutlineapi.client import PyOutlineWrapper
from pyoutlineapi.models import DataLimit

# Initialize the API client
api_url = "https://your-outline-url.com"
cert_sha256 = "your-cert-sha256-fingerprint"
# Set "verify_tls" to False if using a self-signed certificate.
# Set "json_format" to True if answers need to be returned in JSON format. Defaults to False - Pydantic models will be returned.
api_client = PyOutlineWrapper(api_url=api_url, cert_sha256=cert_sha256, verify_tls=False, json_format=True)
```

### Retrieve Server Information

```python
server_info = api_client.get_server_info()
print("Server Information:", server_info)
```

### Create a New Access Key

```python
# Create a new access key with default values
new_access_key = api_client.create_access_key()
# Create a new access key with custom values
new_access_key = api_client.create_access_key(name="my_access_key", password="secure_password", port=8080)

print("New Access Key:", new_access_key)
```

### Delete Access Key

```python
success = api_client.delete_access_key("example-key-id")
print("Access Key Deleted Successfully" if success else "Failed to Delete Access Key")
```

## Additional Functions

### Update Server Port

```python
update_success = api_client.update_server_port(9090)
print("Server Port Updated:", update_success)
```

### Set Data Limit for an Access Key

```python
data_limit = api_client.set_access_key_data_limit("example-key-id", DataLimit(bytes=50000000))
print("Data Limit Set:", data_limit)
```

### Retrieve Metrics

```python
metrics_data = api_client.get_metrics()
print("Metrics Data:", metrics_data)
```

## Contributing

We welcome contributions to PyOutlineAPI! Please follow the guidelines outlined in
the [CONTRIBUTING.md](https://github.com/orenlab/pyoutlineapi/blob/main/CONTRIBUTING.md) file.

## License

PyOutlineAPI is licensed under the MIT [License](https://github.com/orenlab/pyoutlineapi/blob/main/LICENSE). See the
LICENSE file for more details.

## Frequently Asked Questions (FAQ)

___
**How to use self-signed certificates?**

Set the `verify_tls` parameter to `False` when initializing the client.
___
___
**How to change the response format to Pydantic models?**

Set the `json_format` parameter to `False` when initializing the client if you need to receive responses in Pydantic
models.
___
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyoutlineapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "outline, vpn, api, manager, wrapper",
    "author": "Denis Rozhnovskiy",
    "author_email": "pytelemonbot@mail.ru",
    "download_url": "https://files.pythonhosted.org/packages/62/39/3c6e422b6ae7bf53ef6dfbad55551b8c46773ac7e2a4f4d9eca91e17f06a/pyoutlineapi-0.1.3.tar.gz",
    "platform": null,
    "description": "# PyOutlineAPI\n\n`pyoutlineapi` is a Python package designed to interact with the Outline VPN Server API, providing robust data\nvalidation through Pydantic models. This ensures reliable and secure API interactions, making it an excellent choice for\nintegrating with bots and other automated systems that require accurate and secure communication.\n\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=orenlab_pyoutlineapi&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=orenlab_pyoutlineapi)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=orenlab_pyoutlineapi&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=orenlab_pyoutlineapi)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=orenlab_pyoutlineapi&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=orenlab_pyoutlineapi)\n[![tests](https://github.com/orenlab/pyoutlineapi/actions/workflows/python_tests.yml/badge.svg)](https://github.com/orenlab/pyoutlineapi/actions/workflows/python_tests.yml)\n\n## Features\n\n- **Server Management**: Retrieve server information, update hostnames, manage ports, and more.\n- **Access Key Management**: Create, list, rename, and delete access keys, as well as set data limits.\n- **Metrics**: Enable or disable metrics sharing and retrieve data transfer metrics.\n- **Experimental Endpoints**: Access and manage experimental features of the Outline Server API.\n\n## Quick Start\n\nTo get started with `pyoutlineapi`, follow these steps:\n\n1. Install the package using pip or Poetry.\n2. Initialize the `PyOutlineWrapper` client with your Outline VPN server URL and certificate fingerprint.\n3. Use the provided methods to interact with the server and access keys.\n\nSee the examples below for more detailed information.\n\n## Installation\n\nYou can install PyOutlineAPI via [PyPI](https://pypi.org/project/pyoutlineapi/) using pip:\n\n```bash\npip install pyoutlineapi\n```\n\nOr via [Poetry](https://python-poetry.org/):\n\n```bash\npoetry add pyoutlineapi\n```\n\n## Basic Operations\n\n### Initialize the Client\n\n```python\nfrom pyoutlineapi.client import PyOutlineWrapper\nfrom pyoutlineapi.models import DataLimit\n\n# Initialize the API client\napi_url = \"https://your-outline-url.com\"\ncert_sha256 = \"your-cert-sha256-fingerprint\"\n# Set \"verify_tls\" to False if using a self-signed certificate.\n# Set \"json_format\" to True if answers need to be returned in JSON format. Defaults to False - Pydantic models will be returned.\napi_client = PyOutlineWrapper(api_url=api_url, cert_sha256=cert_sha256, verify_tls=False, json_format=True)\n```\n\n### Retrieve Server Information\n\n```python\nserver_info = api_client.get_server_info()\nprint(\"Server Information:\", server_info)\n```\n\n### Create a New Access Key\n\n```python\n# Create a new access key with default values\nnew_access_key = api_client.create_access_key()\n# Create a new access key with custom values\nnew_access_key = api_client.create_access_key(name=\"my_access_key\", password=\"secure_password\", port=8080)\n\nprint(\"New Access Key:\", new_access_key)\n```\n\n### Delete Access Key\n\n```python\nsuccess = api_client.delete_access_key(\"example-key-id\")\nprint(\"Access Key Deleted Successfully\" if success else \"Failed to Delete Access Key\")\n```\n\n## Additional Functions\n\n### Update Server Port\n\n```python\nupdate_success = api_client.update_server_port(9090)\nprint(\"Server Port Updated:\", update_success)\n```\n\n### Set Data Limit for an Access Key\n\n```python\ndata_limit = api_client.set_access_key_data_limit(\"example-key-id\", DataLimit(bytes=50000000))\nprint(\"Data Limit Set:\", data_limit)\n```\n\n### Retrieve Metrics\n\n```python\nmetrics_data = api_client.get_metrics()\nprint(\"Metrics Data:\", metrics_data)\n```\n\n## Contributing\n\nWe welcome contributions to PyOutlineAPI! Please follow the guidelines outlined in\nthe [CONTRIBUTING.md](https://github.com/orenlab/pyoutlineapi/blob/main/CONTRIBUTING.md) file.\n\n## License\n\nPyOutlineAPI is licensed under the MIT [License](https://github.com/orenlab/pyoutlineapi/blob/main/LICENSE). See the\nLICENSE file for more details.\n\n## Frequently Asked Questions (FAQ)\n\n___\n**How to use self-signed certificates?**\n\nSet the `verify_tls` parameter to `False` when initializing the client.\n___\n___\n**How to change the response format to Pydantic models?**\n\nSet the `json_format` parameter to `False` when initializing the client if you need to receive responses in Pydantic\nmodels.\n___",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python package to interact with the Outline VPN Server API",
    "version": "0.1.3",
    "project_urls": {
        "homepage": "https://github.com/orenlab/pyoutlineapi",
        "repository": "https://github.com/orenlab/pyoutlineapi"
    },
    "split_keywords": [
        "outline",
        " vpn",
        " api",
        " manager",
        " wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f92d7ce20c11eb59f293faac196847fd649313b0c4bdb43f03442843859cdb08",
                "md5": "0fe2a77137bc1a8d073b9a0dc8018466",
                "sha256": "e5093cbcb1a4e1726f0a5b823290df072344e10ff81ce3581940c4da09be83e0"
            },
            "downloads": -1,
            "filename": "pyoutlineapi-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0fe2a77137bc1a8d073b9a0dc8018466",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8555,
            "upload_time": "2024-09-01T17:08:49",
            "upload_time_iso_8601": "2024-09-01T17:08:49.376582Z",
            "url": "https://files.pythonhosted.org/packages/f9/2d/7ce20c11eb59f293faac196847fd649313b0c4bdb43f03442843859cdb08/pyoutlineapi-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62393c6e422b6ae7bf53ef6dfbad55551b8c46773ac7e2a4f4d9eca91e17f06a",
                "md5": "5bb7749a405d78440e8f5cae75190b8b",
                "sha256": "10fc29d483bfe81a18f929d71ffd2c3236bbabf4aa93a09044fa34ad7c9a872a"
            },
            "downloads": -1,
            "filename": "pyoutlineapi-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5bb7749a405d78440e8f5cae75190b8b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 6889,
            "upload_time": "2024-09-01T17:08:51",
            "upload_time_iso_8601": "2024-09-01T17:08:51.032582Z",
            "url": "https://files.pythonhosted.org/packages/62/39/3c6e422b6ae7bf53ef6dfbad55551b8c46773ac7e2a4f4d9eca91e17f06a/pyoutlineapi-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-01 17:08:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "orenlab",
    "github_project": "pyoutlineapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyoutlineapi"
}
        
Elapsed time: 0.37341s