Name | outline-vpn-api-client JSON |
Version |
1.2.1
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-12-21 16:14:40 |
maintainer | None |
docs_url | None |
author | zeph1rr |
requires_python | <4.0,>=3.12 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# OUTLINE-VPN-API-CLIENT
![PyPI - Version](https://img.shields.io/pypi/v/outline-vpn-api-client?style=plastic)
![PyPI - Format](https://img.shields.io/pypi/format/outline-vpn-api-client?style=plastic)
![GitHub Release](https://img.shields.io/github/v/release/Zeph1rr/outline-vpn-api-client?style=plastic)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Zeph1rr/outline-vpn-api-client/tests.yml?style=plastic&label=tests)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/outline-vpn-api-client?style=plastic)
![GitHub License](https://img.shields.io/github/license/zeph1rr/outline-vpn-api-client?style=plastic)
## DESCRIPTION
This library provides a convenient interface for managing an Outline VPN server in Python using the official Outline Management API. It simplifies server interaction by enabling you to:
- Programmatically manage user keys, including creation, updates, and deletion.
- Monitor server usage and retrieve detailed statistics.
- Configure server settings such as bandwidth limits and access rules.
- Automate routine maintenance and management tasks.
The library is suitable for both individual users and administrators of corporate VPN solutions, helping to streamline server management, save time, and improve operational efficiency.
It is designed with simplicity in mind and features cleanly implemented, well-documented methods.
## INSTALLATION
### Using pip
```
pip install outline-vpn-api-client
```
### Using poetry
```
poetry add outline-vpn-api-client
```
## USAGE
To get started with the library, you need to obtain the `management_url` for your Outline VPN server. Once you have the `management_url`, you can create an instance of the `OutlineClient` class to interact with the server.
### Initializing the Client
```python
from outline_vpn_api_client import OutlineClient
# Replace 'your.management.url' with your actual management URL
management_url = "your.management.url"
# Create an OutlineClient instance
client = OutlineClient(management_url=management_url)
```
### Retrieving Server Information
```python
import json
# Fetch server information and pretty-print it
print(json.dumps(client.get_information(), ensure_ascii=False, indent=4))
```
### Creating Access Keys
#### Creating a Key Without Limits
```python
# Replace 'name' with a meaningful identifier for the key
client.access_keys.create(name="Example Key")
```
#### Creating a Key With a Limit
```python
# Replace 'name' with a meaningful identifier for the key
# Replace 'limit' with the desired bandwidth limit in bytes
client.access_keys.create(name="Example Key with Limit", limit=10**9) # Example: 1 GB limit
```
### Handling Errors
The library uses a custom exception, ResponseNotOkException, to handle server-side errors. This exception is raised whenever the API returns an unexpected response.
```python
from outline_vpn_api_client import ResponseNotOkException
try:
# Attempting to fetch server information
info = client.get_information()
print(info)
except ResponseNotOkException as e:
print(e)
```
The error message provides details about the HTTP status code and the error message returned by the API. It follows this format:
```python
def _get_error_message(status_code: int, error: str) -> str:
return f"An error occurred: {status_code} - {error}"
```
For example, if the API returns a 404 error with the message "Not Found", the exception will produce the message:
```
outline_vpn_api_client.client.ResponseNotOkException: An error occured: 404 - {'code': 'NotFound', 'message': 'Access key "100" not found'}
```
### Async Usage
For use async client install async version of package:
```
pip install outline-vpn-api-client[async]
```
Then import async client and create instance of this
```
from outline_vpn_api_client.async_client import AsyncOutlineClient
# Replace 'your.management.url' with your actual management URL
management_url = "your.management.url"
# Create an OutlineClient instance
client = AsyncOutlineClient(management_url=management_url)
```
### Console Version
The library also includes a command-line interface (CLI) for quick access. You can use the following command to interact with the server:
```bash
python3 -m outline_vpn_api_client management_url get_info
```
## AUTHOR
Created by **zeph1rr**
Email: [grianton535@gmail.com](mailto:grianton535@gmail.com)
Raw data
{
"_id": null,
"home_page": null,
"name": "outline-vpn-api-client",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": null,
"author": "zeph1rr",
"author_email": "grianton535@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ce/24/fd8e2ac8917d1b1e1b634d97302232dae60dc34e4df3f9e883a8498e0dea/outline_vpn_api_client-1.2.1.tar.gz",
"platform": null,
"description": "# OUTLINE-VPN-API-CLIENT\n\n![PyPI - Version](https://img.shields.io/pypi/v/outline-vpn-api-client?style=plastic)\n![PyPI - Format](https://img.shields.io/pypi/format/outline-vpn-api-client?style=plastic)\n![GitHub Release](https://img.shields.io/github/v/release/Zeph1rr/outline-vpn-api-client?style=plastic)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Zeph1rr/outline-vpn-api-client/tests.yml?style=plastic&label=tests)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/outline-vpn-api-client?style=plastic)\n![GitHub License](https://img.shields.io/github/license/zeph1rr/outline-vpn-api-client?style=plastic)\n\n\n\n## DESCRIPTION\n\nThis library provides a convenient interface for managing an Outline VPN server in Python using the official Outline Management API. It simplifies server interaction by enabling you to:\n\n- Programmatically manage user keys, including creation, updates, and deletion.\n- Monitor server usage and retrieve detailed statistics.\n- Configure server settings such as bandwidth limits and access rules.\n- Automate routine maintenance and management tasks.\n\nThe library is suitable for both individual users and administrators of corporate VPN solutions, helping to streamline server management, save time, and improve operational efficiency.\n\nIt is designed with simplicity in mind and features cleanly implemented, well-documented methods.\n\n## INSTALLATION\n\n### Using pip\n\n```\npip install outline-vpn-api-client\n```\n\n### Using poetry\n\n```\npoetry add outline-vpn-api-client\n```\n\n## USAGE\n\n\nTo get started with the library, you need to obtain the `management_url` for your Outline VPN server. Once you have the `management_url`, you can create an instance of the `OutlineClient` class to interact with the server.\n\n### Initializing the Client\n\n```python\nfrom outline_vpn_api_client import OutlineClient\n\n# Replace 'your.management.url' with your actual management URL\nmanagement_url = \"your.management.url\"\n\n# Create an OutlineClient instance\nclient = OutlineClient(management_url=management_url)\n```\n\n### Retrieving Server Information\n\n```python\nimport json\n\n# Fetch server information and pretty-print it\nprint(json.dumps(client.get_information(), ensure_ascii=False, indent=4))\n```\n\n### Creating Access Keys\n\n#### Creating a Key Without Limits\n\n```python\n# Replace 'name' with a meaningful identifier for the key\nclient.access_keys.create(name=\"Example Key\")\n```\n\n#### Creating a Key With a Limit\n\n```python\n# Replace 'name' with a meaningful identifier for the key\n# Replace 'limit' with the desired bandwidth limit in bytes\nclient.access_keys.create(name=\"Example Key with Limit\", limit=10**9) # Example: 1 GB limit\n```\n\n### Handling Errors\n\nThe library uses a custom exception, ResponseNotOkException, to handle server-side errors. This exception is raised whenever the API returns an unexpected response.\n\n```python\nfrom outline_vpn_api_client import ResponseNotOkException\n\ntry:\n # Attempting to fetch server information\n info = client.get_information()\n print(info)\nexcept ResponseNotOkException as e:\n print(e)\n```\n\nThe error message provides details about the HTTP status code and the error message returned by the API. It follows this format:\n\n```python\ndef _get_error_message(status_code: int, error: str) -> str:\n return f\"An error occurred: {status_code} - {error}\"\n```\n\nFor example, if the API returns a 404 error with the message \"Not Found\", the exception will produce the message:\n\n```\noutline_vpn_api_client.client.ResponseNotOkException: An error occured: 404 - {'code': 'NotFound', 'message': 'Access key \"100\" not found'} \n```\n\n### Async Usage\n\nFor use async client install async version of package:\n```\npip install outline-vpn-api-client[async]\n```\n\nThen import async client and create instance of this\n\n```\nfrom outline_vpn_api_client.async_client import AsyncOutlineClient\n\n# Replace 'your.management.url' with your actual management URL\nmanagement_url = \"your.management.url\"\n\n# Create an OutlineClient instance\nclient = AsyncOutlineClient(management_url=management_url)\n```\n\n### Console Version\n\nThe library also includes a command-line interface (CLI) for quick access. You can use the following command to interact with the server:\n\n```bash\npython3 -m outline_vpn_api_client management_url get_info\n```\n\n## AUTHOR\n\nCreated by **zeph1rr** \nEmail: [grianton535@gmail.com](mailto:grianton535@gmail.com)",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "1.2.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ea5966ac7bcc4d391e2ff1ae4e458403d7d54b09de8e28ed076500ea51ff6b3b",
"md5": "eea3540f80a426afb9278a6cd6857634",
"sha256": "337a9f295654f43a34699db6fe6e89d2d9216cbc4765cd77f63ba0cf60c7f966"
},
"downloads": -1,
"filename": "outline_vpn_api_client-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eea3540f80a426afb9278a6cd6857634",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 12260,
"upload_time": "2024-12-21T16:14:38",
"upload_time_iso_8601": "2024-12-21T16:14:38.246845Z",
"url": "https://files.pythonhosted.org/packages/ea/59/66ac7bcc4d391e2ff1ae4e458403d7d54b09de8e28ed076500ea51ff6b3b/outline_vpn_api_client-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ce24fd8e2ac8917d1b1e1b634d97302232dae60dc34e4df3f9e883a8498e0dea",
"md5": "7c89f7dd73fcd445b598fafad87470f9",
"sha256": "8a2f40f7eecf39f7dfcc305459cba2b19b8925c9c1d91f716f00177e1e804ffb"
},
"downloads": -1,
"filename": "outline_vpn_api_client-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "7c89f7dd73fcd445b598fafad87470f9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 10372,
"upload_time": "2024-12-21T16:14:40",
"upload_time_iso_8601": "2024-12-21T16:14:40.420232Z",
"url": "https://files.pythonhosted.org/packages/ce/24/fd8e2ac8917d1b1e1b634d97302232dae60dc34e4df3f9e883a8498e0dea/outline_vpn_api_client-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-21 16:14:40",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "outline-vpn-api-client"
}