Skip to content
프로젝트

소개

ExpressVPN - Python Wrapper (IP auto switch).

시스템 및 인프라

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

ExpressVPN - Python Wrapper (LINUX)

Downloads Downloads

Full bash documentation: https://www.expressvpn.com/support/vpn-setup/app-for-linux/

This will not work on Windows!

Installation with PyPI

If the command expressvpn is already installed on your Ubuntu then just run this:

pip install expressvpn-python

Download/Install the package on the official website

The package DEB for Ubuntu 64bits 2.3.4 is already part of the repository. For another OS, please refer to: https://www.expressvpn.com/support/vpn-setup/app-for-linux/#download

git clone [email protected]:philipperemy/expressvpn-python.git evpn && cd evpn
sudo dpkg -i expressvpn_2.3.4-1_amd64.deb # will install the binaries provided by ExpressVPN
sudo pip install . # will install it as a package. Or install it within a virtualenv (better option).

Change your public IP every x seconds

Check the script: vpn.sh.

Set up expressvpn

You can find your activation key here: https://www.expressvpn.com/setup.

expressvpn activate # paste your activate key and press ENTER.
expressvpn preferences set send_diagnostics false

After login and to logout, simply run:

expressvpn logout

NOTE that you will have to activate expressvpn again if you logout.

Python bindings

Connect

Bash

expressvpn connect

Python

from expressvpn import connect
connect()

Connect with alias

Bash

expressvpn connect [ALIAS]

Python

from expressvpn import connect_alias
connect_alias(alias: str)

Random connect(From fastest servers)

Python

from expressvpn.wrapper import random_connect
random_connect()

Random connect(From all servers)

Python

from expressvpn.wrapper import random_connect
random_connect(True)

Disconnect

Bash

expressvpn disconnect

Python

from expressvpn import disconnect
disconnect()

IP auto switching

Sometimes 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:

import logging

from expressvpn import wrapper


class BannedException(Exception):
    pass


def main():
    while True:
        try:
            scrape()
        except BannedException as be:
            logging.info('BANNED EXCEPTION in __MAIN__')
            logging.info(be)
            logging.info('Lets change our PUBLIC IP GUYS!')
            change_ip()
        except Exception as e:
            logging.error('Exception raised.')
            logging.error(e)


def change_ip():
    max_attempts = 10
    attempts = 0
    while True:
        attempts += 1
        try:
            logging.info('GETTING NEW IP')
            wrapper.random_connect()
            logging.info('SUCCESS')
            return
        except Exception as e:
            if attempts > max_attempts:
                logging.error('Max attempts reached for VPN. Check its configuration.')
                logging.error('Browse https://github.com/philipperemy/expressvpn-python.')
                logging.error('Program will exit.')
                exit(1)
            logging.error(e)
            logging.error('Skipping exception.')

관련 프로젝트 살펴보기

불러오는 중…