Skip to content

Adding proxy and CA SSL support#8

Open
giubaru wants to merge 2 commits intosinghsidhukuldeep:mainfrom
giubaru:feature/proxy-support
Open

Adding proxy and CA SSL support#8
giubaru wants to merge 2 commits intosinghsidhukuldeep:mainfrom
giubaru:feature/proxy-support

Conversation

@giubaru
Copy link
Copy Markdown
Contributor

@giubaru giubaru commented Sep 15, 2022

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 giubaru mentioned this pull request Sep 15, 2022
@singhsidhukuldeep
Copy link
Copy Markdown
Owner

singhsidhukuldeep commented Sep 18, 2022

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

Otherwise, we would complicate things!

@Hex2424
Copy link
Copy Markdown

Hex2424 commented Feb 6, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants