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.1.tar.gz (16.1 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.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: requests_chain-0.1.1.tar.gz
  • Upload date:
  • Size: 16.1 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.1.tar.gz
Algorithm Hash digest
SHA256 002d9a652a504f1e92f3e3e9cd7df91cabb76a7e7fa6002787f489e54c49fdb4
MD5 9de848bf2e126dbb6b60eb6c3c13f9b2
BLAKE2b-256 e76d9e90ca62734cd731e27024bf33d9932ccf4d339572d52a6107e35965c45f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: requests_chain-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e2743d2f24b7c5d4602e745f9d764969205da883db26e3fed34d4d0750e737c
MD5 c4a25fed75fe370070848af339caeac8
BLAKE2b-256 8e6845c63f85fa9cc14dfdcf6cef1ebe058e0e9295ea0cd3f31d45542a288636

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