request-boost icon indicating copy to clipboard operation
request-boost copied to clipboard

Adding proxy and CA SSL support

Open giubaru opened this issue 2 years ago • 2 comments

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 avatar Sep 15 '22 23:09 giubaru

@giubaru Thanks for the PR I think a better way would be just to use *args and **kwargs

Otherwise, we would complicate things!

singhsidhukuldeep avatar Sep 18 '22 05:09 singhsidhukuldeep

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)

Hex2424 avatar Feb 06 '23 08:02 Hex2424