Async Python API wrapper for Outline VPN
Project description
outline-vpn-api-async
A Python API wrapper for Outline VPN
This is a fork of https://github.com/jadolg/outline-vpn-api
How to use
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
pip install -e .
Fill out test.env with your test server creds
cp test.env.example test.env
Run tests
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file outline-vpn-api-async-0.1.2.tar.gz.
File metadata
- Download URL: outline-vpn-api-async-0.1.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23cf40928fc806cdd9c4b2ea819f3e072cece310ce28548c1ac516f825fa8ae0
|
|
| MD5 |
a56c3343bf26528a9a4d9f8b4ade9b4a
|
|
| BLAKE2b-256 |
cd65f7addecf68e5543c466c6511db357f6f57393c1c95377ae0096056a3aacd
|
File details
Details for the file outline_vpn_api_async-0.1.2-py3-none-any.whl.
File metadata
- Download URL: outline_vpn_api_async-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9e3a07e57a56d27632c3e4c936e4fb03aa626c5366ca6d921cf9733ab72d6e7
|
|
| MD5 |
f4b86a2cf9dabed498ae05c5c6542b73
|
|
| BLAKE2b-256 |
5af33cb500b2697bb5664d5d13586e0f373acf86a60f968971aa7156e69b326e
|