# PyProton
[![PyPI version](https://badge.fury.io/py/pyproton.svg)](https://badge.fury.io/py/pyproton)
This package is a lightweight minimal wrapper implementation of the linux protonvpn-cli; designed to be an intuitive and simple to use interface for the Proton VPN in python.
## Getting Started
**Version compatibility:**
`Proton VPN CLI v3.13.0 (protonvpn-nm-lib v3.14.0; proton-client v0.7.1)`
### **Install the CLI:**
[Proton VPN Docs](https://protonvpn.com/support/linux-vpn-tool/)
Debian based distros
1. [Download the Proton VPN DEB package](https://repo.protonvpn.com/debian/dists/stable/main/binary-all/protonvpn-stable-release_1.0.3_all.deb)
2. Install the Proton VPN repository
`sudo apt-get install {/path/to/}protonvpn-stable-release_1.0.3_all.deb`
3. Update the apt-get package list
`sudo apt-get update`
4. Install the Proton VPN Linux CLI
`sudo apt-get install protonvpn-cli`
### **Install pyproton:**
`pip install pyproton`
### **Import and use pyproton VPN:**
#### Args
* `user` **required:** user name string
* `pw` **required:** password string
* `verbose` **optional:** (`default=False`) turns on/off the stdin output for each step.
* `retries` **optional:** (`default=3`) defines number of retries when a VPN connection attempt times out.
* `timeout` **optional:** (`default=5`) seconds to wait before timing out a login attempt.
* `location` **optional:** (`default='U'`) location of servers to connect to (free servers only): `{'J':'Japan','N':'Netherlands','U':'United States'}`.
#### Methods
* `vpn.login()` log the user into proton VPN - (context manager): `__enter__`
* `vpn.logout()` log the user out of proton VPN - (context manager): `__exit__`
* `vpn.connect()` connect to proton VPN endpoint - (context manager): `__enter__`
* `vpn.disconnect()` disconnect from proton VPN endpoint - (context manager): `__exit__`
* `vpn.shuffle()` disconnects from the current VPN and connected to another
#### Basic Usage
**NOTE:** It is generally recommended to use `dotenv` or another method for loading in secrets. Please do NOT hardcode account credentials in a production environment, this is a critical security risk!
```python
import os
from pyproton import VPN
user = 'user'
pw = 'pw'
with VPN(user, pw) as vpn:
print('do some stuff')
vpn.shuffle()
print('do more stuff')
```
### **TO-DO**
* Improve reliability
* PyTest & Tox testing
* Sphynx docs
* Coverage
* Deepsource scanning
Raw data
{
"_id": null,
"home_page": "https://github.com/aastopher/pyproton",
"name": "pyproton",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "vpn,proton vpn,proton,wrapper,cli",
"author": "Aaron Stopher",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/d4/af/5b27c34305362fcd78850dc3def4c9d3b95d98a1aaeb4c2f7b9b60d31f2e/pyproton-0.0.5.tar.gz",
"platform": null,
"description": "# PyProton\n\n[![PyPI version](https://badge.fury.io/py/pyproton.svg)](https://badge.fury.io/py/pyproton)\n\nThis package is a lightweight minimal wrapper implementation of the linux protonvpn-cli; designed to be an intuitive and simple to use interface for the Proton VPN in python.\n\n## Getting Started\n\n**Version compatibility:**\n\n`Proton VPN CLI v3.13.0 (protonvpn-nm-lib v3.14.0; proton-client v0.7.1)`\n\n### **Install the CLI:**\n\n[Proton VPN Docs](https://protonvpn.com/support/linux-vpn-tool/)\n\nDebian based distros\n1. [Download the Proton VPN DEB package](https://repo.protonvpn.com/debian/dists/stable/main/binary-all/protonvpn-stable-release_1.0.3_all.deb)\n2. Install the Proton VPN repository\n \n `sudo apt-get install {/path/to/}protonvpn-stable-release_1.0.3_all.deb`\n3. Update the apt-get package list\n \n `sudo apt-get update`\n4. Install the Proton VPN Linux CLI\n \n `sudo apt-get install protonvpn-cli` \n\n### **Install pyproton:**\n\n`pip install pyproton`\n\n### **Import and use pyproton VPN:**\n\n#### Args\n\n* `user` **required:** user name string\n* `pw` **required:** password string\n* `verbose` **optional:** (`default=False`) turns on/off the stdin output for each step.\n* `retries` **optional:** (`default=3`) defines number of retries when a VPN connection attempt times out.\n* `timeout` **optional:** (`default=5`) seconds to wait before timing out a login attempt.\n* `location` **optional:** (`default='U'`) location of servers to connect to (free servers only): `{'J':'Japan','N':'Netherlands','U':'United States'}`.\n\n#### Methods\n\n* `vpn.login()` log the user into proton VPN - (context manager): `__enter__`\n* `vpn.logout()` log the user out of proton VPN - (context manager): `__exit__`\n* `vpn.connect()` connect to proton VPN endpoint - (context manager): `__enter__`\n* `vpn.disconnect()` disconnect from proton VPN endpoint - (context manager): `__exit__`\n* `vpn.shuffle()` disconnects from the current VPN and connected to another\n\n#### Basic Usage\n\n**NOTE:** It is generally recommended to use `dotenv` or another method for loading in secrets. Please do NOT hardcode account credentials in a production environment, this is a critical security risk!\n\n```python\nimport os\nfrom pyproton import VPN\n\nuser = 'user'\npw = 'pw'\n\nwith VPN(user, pw) as vpn:\n print('do some stuff')\n vpn.shuffle()\n print('do more stuff')\n```\n\n### **TO-DO**\n\n* Improve reliability\n* PyTest & Tox testing\n* Sphynx docs\n* Coverage\n* Deepsource scanning\n",
"bugtrack_url": null,
"license": "",
"summary": "Minimal wrapper implementation of the linux protonvpn-cli",
"version": "0.0.5",
"project_urls": {
"Bug Tracker": "https://github.com/aastopher/pyproton/issues",
"Homepage": "https://github.com/aastopher/pyproton"
},
"split_keywords": [
"vpn",
"proton vpn",
"proton",
"wrapper",
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8e8a13ad03578bdad778278543260e54dd7b04c4ae1f33c64d0bbd79716a0de5",
"md5": "484b29ffd6aa6fd5b0a7dc783e942073",
"sha256": "52efe7ecaec08d814798c566ea9eb2fda2ad2598416644257e226d93816fc530"
},
"downloads": -1,
"filename": "pyproton-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "484b29ffd6aa6fd5b0a7dc783e942073",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4948,
"upload_time": "2023-05-07T07:05:11",
"upload_time_iso_8601": "2023-05-07T07:05:11.671996Z",
"url": "https://files.pythonhosted.org/packages/8e/8a/13ad03578bdad778278543260e54dd7b04c4ae1f33c64d0bbd79716a0de5/pyproton-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d4af5b27c34305362fcd78850dc3def4c9d3b95d98a1aaeb4c2f7b9b60d31f2e",
"md5": "b49000abb7462d689383829b609c42a8",
"sha256": "f229b7399fab57ed8103ea465fb218775a4e52ea466124a147a7cc3506d96e9c"
},
"downloads": -1,
"filename": "pyproton-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "b49000abb7462d689383829b609c42a8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 4714,
"upload_time": "2023-05-07T07:05:14",
"upload_time_iso_8601": "2023-05-07T07:05:14.372877Z",
"url": "https://files.pythonhosted.org/packages/d4/af/5b27c34305362fcd78850dc3def4c9d3b95d98a1aaeb4c2f7b9b60d31f2e/pyproton-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-07 07:05:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aastopher",
"github_project": "pyproton",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyproton"
}