I
I
ineveraskdfrths2021-07-26 23:52:19
Python
ineveraskdfrths, 2021-07-26 23:52:19

How to use proxy in request if I use it in run_in_executor?

I want to write an asynchronous proxy checker that checks for https proxies.
Tell me how to pass a proxy to the request, code:

def main():
    loop = asyncio.get_event_loop()
    future1 = loop.run_in_executor(None, requests.get, {'url':'http://www.google.com','proxy': {
    'https':'https://login:[email protected]:9122'}})
    response1 = yield from future1
    print(response1.status_code)

does not work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ineveraskdfrths, 2021-07-27
@ineveraskdfrths

The question was stupid (I was drunk), just use requests_html or aiohttp.
aiohttp only supports http proxies, but this is not a problem since for the vast majority of https proxies work in http, if they do not have a block, just send them to the request as regular proxies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question