Skip to main content

Adds the ability of using a proxy chains to the python requests module.

Project description

Requests chains

Adds the ability to use proxy chains directly the python requests module.

Import necessary modules

import requests
from requests_chains import chain_requests

Set up proxy chains

proxychains = [
  "socks5://127.0.0.1:9050",
  "socks5://user:pwd@ip:port"
]

chain_requests(proxychains) # Patch requests to use proxy chains

Done. Any requests from now on will be firstly send thorugh the chain specified.

How to add another proxy on top of this chain ? Simple!

With requests-chain you can just use the normal requests proxies built-in param to add a proxy, and that will be build on top of the chain specified!

r1 = s.get('http://api.ipify.org?format=json', proxies={"http":"socks5://proxy1:port1", "https":"socks5://proxy1:port1"})
r2 = s.get('http://api.ipify.org?format=json', proxies={"http":"socks5://proxy2:port2", "https":"socks5://proxy2:port2"})
print(r1.text)
  • r1 will firstly go through the whole chain and then on proxy1
  • r2 will firstly go through the whole chain and then on proxy2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests_chain-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

requests_chain-0.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file requests_chain-0.1.0.tar.gz.

File metadata

  • Download URL: requests_chain-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for requests_chain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 47f1676b33462a62bc69a65f32530b32055a7e2df7c0769957d2053e0c112e80
MD5 04704b568cd6b9f3d7656ea5e3d9a2cd
BLAKE2b-256 83acf7ec0198723b0e4f91c1777b1c909be7325d53d23bb7b227273b90c0b465

See more details on using hashes here.

File details

Details for the file requests_chain-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: requests_chain-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for requests_chain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfbbaca16020ab08227b80ab11655d7baf70b34d3c31d783451eed1af5e2ab3a
MD5 02a2f9ccf8e86fdc884a9a04274ea0a4
BLAKE2b-256 668798193c226096ad5992f6e705c35121047dd7e2a658933e1d25263329c1a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page