Coder Social home page Coder Social logo

proxy-db's Introduction

image

Latest Tests CI build status

Latest PyPI version

Python versions

Code Climate

Test coverage

Requirements Status

proxy-db

Manage free and private proxies on local db for Python Projects. Each proxy has a score according to how it works. Add a positive vote if the proxy works correctly and a negative vote if it does not work.

import requests
from requests.exceptions import Timeout, ConnectionError, ProxyError
from proxy_db.proxies import ProxiesList

proxy = next(ProxiesList())
try:
    requests.get('http://site.com/', proxies=proxy)
except (Timeout, ConnectionError, ProxyError):
    proxy.negative()
else:
    proxy.positive()

Proxy-db will return the best proxies first (more positive votes). You can also filter by country:

from proxy_db.proxies import ProxiesList

spain_proxy = next(ProxiesList('es'))
# ...

You can also filter by provider:

from proxy_db.proxies import ProxiesList

proxy_nova_proxy = next(ProxiesList(provider='Proxy Nova'))
# ...

Free proxies providers included:

  • Proxy Nova
  • Nord VPN (requires PROXYDB_NORDVPN_USERNAME & PROXYDB_NORDVPN_PASSWORD env. variables).

For more information see the docs.

Install

If you have Pip installed on your system, you can use it to install the latest ProxyDB stable version:

$ pip3 install proxy-db

Python 2.7 & 3.4-3.9 are supported but Python 3.x is recommended. Use pip2 on install for Python2. More info in the documentation

Some providers do not have the correct country for proxies. To determine the correct country proxy-db can use geoip. To use this install the optional dependencies:

$ pip3 install proxy-db[geoip]

You also need a maxmind Geolite2 license (it's free). To obtain the license, follow these steps:

  1. Sign up for a Maxmind Geolite2 account
  2. Log in to your Maxmind account
  3. In the menu on the left, navigate to Services > My License Key.
  4. Click Generate new license key.

Sets the environment variable MAXMIND_LICENSE_KEY. To set it from Python:

import os
os.environ['MAXMIND_LICENSE_KEY'] = '28xjifHSTxVq93xZ'

HTTPS & SOCKS5 proxies

To use socks5 proxies with requests you need to install socks support:

$ pip3 install proxy-db[socks]

To use HTTPS proxies with requests/urllib3 you need to install the latests urllib3 version from sources:

$ pip install https://github.com/urllib3/urllib3/archive/master.zip

proxy-db's People

Contributors

nekmo avatar realvaz1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.