{"id":15631682,"url":"https://github.com/philipperemy/expressvpn-python","last_synced_at":"2025-04-06T00:08:15.181Z","repository":{"id":45468817,"uuid":"82646064","full_name":"philipperemy/expressvpn-python","owner":"philipperemy","description":"ExpressVPN - Python Wrapper (IP auto switch).","archived":false,"fork":false,"pushed_at":"2023-03-19T05:49:07.000Z","size":28780,"stargazers_count":195,"open_issues_count":0,"forks_count":47,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T23:11:09.045Z","etag":null,"topics":["python","vpn","vpn-client","vpn-connections","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philipperemy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["philipperemy"]}},"created_at":"2017-02-21T06:43:41.000Z","updated_at":"2025-03-28T10:20:05.000Z","dependencies_parsed_at":"2024-10-03T10:41:20.941Z","dependency_job_id":"20f9c178-d457-46f9-94ff-a00b4566adc9","html_url":"https://github.com/philipperemy/expressvpn-python","commit_stats":{"total_commits":42,"total_committers":5,"mean_commits":8.4,"dds":"0.38095238095238093","last_synced_commit":"7523d0c2bd4775da44f58cc59001a84c13db9f08"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fexpressvpn-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fexpressvpn-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fexpressvpn-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fexpressvpn-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philipperemy","download_url":"https://codeload.github.com/philipperemy/expressvpn-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415969,"owners_count":20935388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","vpn","vpn-client","vpn-connections","wrapper"],"created_at":"2024-10-03T10:41:14.906Z","updated_at":"2025-04-06T00:08:15.159Z","avatar_url":"https://github.com/philipperemy.png","language":"Python","funding_links":["https://github.com/sponsors/philipperemy"],"categories":[],"sub_categories":[],"readme":"# ExpressVPN - Python Wrapper (LINUX)\n\n[![Downloads](https://static.pepy.tech/badge/expressvpn-python)](https://pepy.tech/project/expressvpn-python)\n[![Downloads](https://static.pepy.tech/badge/expressvpn-python/month)](https://pepy.tech/project/expressvpn-python)\n\nFull bash documentation: [https://www.expressvpn.com/support/vpn-setup/app-for-linux/](https://www.expressvpn.com/support/vpn-setup/app-for-linux/)\n\nThis will not work on Windows!\n\n\n## Installation with PyPI\n\nIf the command `expressvpn` is already installed on your Ubuntu then just run this:\n\n```bash\npip install expressvpn-python\n```\n\n## Download/Install the package on the official website\n\nThe package DEB for Ubuntu 64bits 2.3.4 is already part of the repository. For another OS, please refer to:\n[https://www.expressvpn.com/support/vpn-setup/app-for-linux/#download](https://www.expressvpn.com/support/vpn-setup/app-for-linux/#download)\n\n```bash\ngit clone git@github.com:philipperemy/expressvpn-python.git evpn \u0026\u0026 cd evpn\nsudo dpkg -i expressvpn_2.3.4-1_amd64.deb # will install the binaries provided by ExpressVPN\nsudo pip install . # will install it as a package. Or install it within a virtualenv (better option).\n```\n\n## Change your public IP every x seconds\n\nCheck the script: [vpn.sh](vpn.sh).\n\n## Set up expressvpn\n\nYou can find your activation key here: [https://www.expressvpn.com/setup](https://www.expressvpn.com/setup).\n\n```bash\nexpressvpn activate # paste your activate key and press ENTER.\nexpressvpn preferences set send_diagnostics false\n```\n\nAfter login and to logout, simply run:\n\n```bash\nexpressvpn logout\n```\n\nNOTE that you will have to activate `expressvpn` again if you logout.\n\n## Python bindings\n\n### Connect\n\nBash\n```bash\nexpressvpn connect\n```\n\nPython\n```python\nfrom expressvpn import connect\nconnect()\n```\n\n### Connect with alias\n\nBash\n```bash\nexpressvpn connect [ALIAS]\n```\n\nPython\n```python\nfrom expressvpn import connect_alias\nconnect_alias(alias: str)\n```\n\n### Random connect(From fastest servers)\nPython\n```python\nfrom expressvpn.wrapper import random_connect\nrandom_connect()\n```\n\n### Random connect(From all servers)\nPython\n```python\nfrom expressvpn.wrapper import random_connect\nrandom_connect(True)\n```\n\n###\n\n### Disconnect\n\nBash\n```bash\nexpressvpn disconnect\n```\n\nPython\n```python\nfrom expressvpn import disconnect\ndisconnect()\n```\n\n## IP auto switching\n\nSometimes websites like Amazon or Google will ban you after too many requests. It's easy to detect because your script will fail for some obscure reason. Most of the time, if the HTML contains the word captcha or if the websites returns 403, it means that you probably got banned. But don't panic, you can use a VPN coupled with IP auto switching. Here's an example of a scraper doing IP auto switching:\n\n```python\nimport logging\n\nfrom expressvpn import wrapper\n\n\nclass BannedException(Exception):\n    pass\n\n\ndef main():\n    while True:\n        try:\n            scrape()\n        except BannedException as be:\n            logging.info('BANNED EXCEPTION in __MAIN__')\n            logging.info(be)\n            logging.info('Lets change our PUBLIC IP GUYS!')\n            change_ip()\n        except Exception as e:\n            logging.error('Exception raised.')\n            logging.error(e)\n\n\ndef change_ip():\n    max_attempts = 10\n    attempts = 0\n    while True:\n        attempts += 1\n        try:\n            logging.info('GETTING NEW IP')\n            wrapper.random_connect()\n            logging.info('SUCCESS')\n            return\n        except Exception as e:\n            if attempts \u003e max_attempts:\n                logging.error('Max attempts reached for VPN. Check its configuration.')\n                logging.error('Browse https://github.com/philipperemy/expressvpn-python.')\n                logging.error('Program will exit.')\n                exit(1)\n            logging.error(e)\n            logging.error('Skipping exception.')\n ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipperemy%2Fexpressvpn-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilipperemy%2Fexpressvpn-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipperemy%2Fexpressvpn-python/lists"}