# outline-vpn-api-async
A Python API wrapper for [Outline VPN](https://getoutline.org/)
This is a fork of https://github.com/jadolg/outline-vpn-api
[](https://github.com/dogekiller21/outline-vpn-api-async/actions/workflows/test.yml)
## How to use
```python
from outline_vpn import OutlineVPN
async def main():
# Setup the access with the API URL (Use the one provided to you after the server setup)
client = OutlineVPN(api_url="https://127.0.0.1:51083/xlUG4F5BBft4rSrIvDSWuw")
# Init the client with setting cert_sha256
await client.init(cert_sha256="4EFF7BB90BCE5D4A172D338DC91B5B9975E197E39E3FA4FC42353763C4E58765")
# Get all access URLs on the server
for key in await client.get_keys():
print(key.access_url)
# Get a single key by it id
my_cool_key = await client.get_key(key_id=1337)
print(my_cool_key.access_url)
# Create a new key
new_key = await client.create_key()
# [Optional] You can set a name to key while creating it to auto rename
new_key = await client.create_key(key_name="My cool key")
# Rename it
await client.rename_key(key_id=new_key.key_id, name="new_key")
# Delete it
await client.delete_key(key_id=new_key.key_id)
# Set a monthly data limit for a key (20MB)
await client.add_data_limit(key_id=new_key.key_id, limit_bytes=1000 * 1000 * 20)
# Remove the data limit
await client.delete_data_limit(key_id=new_key.key_id)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
```
## Contribution
Install locally
```bash
pip install -e .
```
Fill out test.env with your test server creds
```bash
cp test.env.example test.env
```
Run tests
```bash
pytest
```
Raw data
{
"_id": null,
"home_page": "https://github.com/dogekiller21/outline-vpn-api-async",
"name": "outline-vpn-api-async",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Maxim (dogekiller21) Polyakov",
"author_email": "dogekiller21@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cd/65/f7addecf68e5543c466c6511db357f6f57393c1c95377ae0096056a3aacd/outline-vpn-api-async-0.1.2.tar.gz",
"platform": null,
"description": "# outline-vpn-api-async\n\nA Python API wrapper for [Outline VPN](https://getoutline.org/)\n\nThis is a fork of https://github.com/jadolg/outline-vpn-api\n\n[](https://github.com/dogekiller21/outline-vpn-api-async/actions/workflows/test.yml)\n\n## How to use\n\n```python\nfrom outline_vpn import OutlineVPN\n\nasync def main():\n # Setup the access with the API URL (Use the one provided to you after the server setup)\n client = OutlineVPN(api_url=\"https://127.0.0.1:51083/xlUG4F5BBft4rSrIvDSWuw\")\n # Init the client with setting cert_sha256\n await client.init(cert_sha256=\"4EFF7BB90BCE5D4A172D338DC91B5B9975E197E39E3FA4FC42353763C4E58765\")\n \n # Get all access URLs on the server\n for key in await client.get_keys():\n print(key.access_url)\n \n # Get a single key by it id\n my_cool_key = await client.get_key(key_id=1337)\n print(my_cool_key.access_url)\n \n # Create a new key\n new_key = await client.create_key()\n \n # [Optional] You can set a name to key while creating it to auto rename\n new_key = await client.create_key(key_name=\"My cool key\")\n \n # Rename it\n await client.rename_key(key_id=new_key.key_id, name=\"new_key\")\n \n # Delete it\n await client.delete_key(key_id=new_key.key_id)\n \n # Set a monthly data limit for a key (20MB)\n await client.add_data_limit(key_id=new_key.key_id, limit_bytes=1000 * 1000 * 20)\n \n # Remove the data limit\n await client.delete_data_limit(key_id=new_key.key_id)\n\n \nif __name__ == \"__main__\":\n import asyncio\n asyncio.run(main())\n\n```\n\n## Contribution\n\nInstall locally\n```bash\npip install -e .\n```\n\nFill out test.env with your test server creds\n```bash\ncp test.env.example test.env\n```\n\nRun tests\n```bash\npytest\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Async Python API wrapper for Outline VPN",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/dogekiller21/outline-vpn-api-async"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5af33cb500b2697bb5664d5d13586e0f373acf86a60f968971aa7156e69b326e",
"md5": "f4b86a2cf9dabed498ae05c5c6542b73",
"sha256": "d9e3a07e57a56d27632c3e4c936e4fb03aa626c5366ca6d921cf9733ab72d6e7"
},
"downloads": -1,
"filename": "outline_vpn_api_async-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f4b86a2cf9dabed498ae05c5c6542b73",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6318,
"upload_time": "2024-08-09T22:52:53",
"upload_time_iso_8601": "2024-08-09T22:52:53.489470Z",
"url": "https://files.pythonhosted.org/packages/5a/f3/3cb500b2697bb5664d5d13586e0f373acf86a60f968971aa7156e69b326e/outline_vpn_api_async-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cd65f7addecf68e5543c466c6511db357f6f57393c1c95377ae0096056a3aacd",
"md5": "a56c3343bf26528a9a4d9f8b4ade9b4a",
"sha256": "23cf40928fc806cdd9c4b2ea819f3e072cece310ce28548c1ac516f825fa8ae0"
},
"downloads": -1,
"filename": "outline-vpn-api-async-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "a56c3343bf26528a9a4d9f8b4ade9b4a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5144,
"upload_time": "2024-08-09T22:52:54",
"upload_time_iso_8601": "2024-08-09T22:52:54.762623Z",
"url": "https://files.pythonhosted.org/packages/cd/65/f7addecf68e5543c466c6511db357f6f57393c1c95377ae0096056a3aacd/outline-vpn-api-async-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-09 22:52:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dogekiller21",
"github_project": "outline-vpn-api-async",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "outline-vpn-api-async"
}