Skip to content

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

Notifications You must be signed in to change notification settings

makovez/requests-chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

⚠️ Known Bugs ⚠️

when using http proxies both in the specified proxychains and after, in the requests built-in proxies param, it will throw exceptions.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages