request-boost
request-boost copied to clipboard
Adding proxy and CA SSL support
How to use the proxy support:
from request_boost import boosted_requests
number_of_sample_urls = 2
urls = [ f'https://postman-echo.com/get?random_data={test_no}' for test_no in range(number_of_sample_urls) ]
headers = [{'sample_header':test_no} for test_no in range(number_of_sample_urls)]
simple_results = boosted_requests(urls=urls, proxy={'http': 'localhost:8000'})
print(simple_results)
How to add SSL certification:
Here you should install: pip install certifi
import certifi
from request_boost import boosted_requests
number_of_sample_urls = 2
urls = [ f'https://postman-echo.com/get?random_data={test_no}' for test_no in range(number_of_sample_urls) ]
headers = [{'sample_header':test_no} for test_no in range(number_of_sample_urls)]
simple_results = boosted_requests(urls=urls, cafile=certifi.where())
print(simple_results)
@giubaru Thanks for the PR
I think a better way would be just to use *args
and **kwargs
Otherwise, we would complicate things!
Agreed, I need this feature also for this project: https://github.com/Hex2424/ProxyRipper I will fork your project and ask for merged changes. I see some commited changes towards proxy support by @giubaru , but it let you set only 1 proxy, it should work with list of proxies same as it done with list of urls.
req = urlrequest.Request(url)
req.set_proxy(proxy_host, 'http')
Also I think it should have additional argument and not kwargs, cuz granting confusion.
proxies = [
{'http': 'socks://localhost:8000',
'https': 'socks://localhost:8000'}
]
boosted_requests(urls=urls, proxies=proxies)