spyoungtech / grequests

Requests + Gevent = <3
https://pypi.python.org/pypi/grequests
BSD 2-Clause "Simplified" License
4.49k stars 331 forks source link

socks5 proxy is used grequests returns None #107

Closed themidnightoil closed 6 years ago

themidnightoil commented 7 years ago
    proxies = {
        "http": 'socks5://...',
        "https": 'socks5://...'

    }
    rs = (grequests.get(url,proxies = proxies) for url in urls)
    responses = grequests.map(rs)
    print(responses)

returns [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None.,.,.,]

mdomans commented 7 years ago

Same problem here, though using crawlera as a proxy.

@kennethreitz I can provide very extensive example if you need to test it.

spyoungtech commented 6 years ago

Was not able to reproduce this issue testing in a number of situations.

In [19]: urls = ['https://httpbin.org/delay/2' for _ in range(10)]

In [20]: req_list = [grequests.get(url, proxies=proxies) for url in urls]

In [21]: result = grequests.map(req_list)

In [22]: result
Out[22]:
[<Response [200]>,
 <Response [200]>,
 <Response [200]>,
 <Response [200]>,
 <Response [200]>,
 <Response [200]>,
 <Response [200]>,
 <Response [200]>,
 <Response [200]>,
 <Response [200]>]
spyoungtech commented 6 years ago

If this is still an issue, try adding an exception handler and provide the applicable exception. I don't think this is an issue caused directly by grequests.

jonleach445 commented 6 months ago

I'm having same issue when inside an async function, outside of an async function works fine