connectionpool:Setting: read timeout to None & "'Task got bad yield: <Response [200]>'"

Hi,
I'm porting the already functioning (in python3.4) code
(https://github.com/KeepSafe/aiohttp/blob/master/examples/crawl.py ) into python2.76 code, 
through trollius, urllib and requests.

But....the output I get is:

time python crawl_requests.py http://www.ilsole24ore.com/english-version/front-page.shtml
DEBUG:trollius:Using selector: EpollSelector
('url to do = ', 'http://www.ilsole24ore.com/english-version/front-page.shtml')
('processing:', 'http://www.ilsole24ore.com/english-version/front-page.shtml')
INFO:urllib3.connectionpool:Starting new HTTP connection (1): www.ilsole24ore.com
DEBUG:urllib3.connectionpool:Setting read timeout to None
DEBUG:urllib3.connectionpool:"GET /english-version/front-page.shtml HTTP/1.1" 200 13699
('...', 'http://www.ilsole24ore.com/english-version/front-page.shtml', 'has error', "'Task got bad yield: <Response [200]>'")
('done:', 1, '; ok:', 0)

Here is my code:
http://ipaste.org/fLj

Could pleas give me some hints in solving this issue?
Lookin forward to your helpfull hints and suggestions.
Kind regards.
Marco


This is not a requests bug. =) We do not support asyncio.

The fact that you attempted this suggests you don't have a full understanding of how asyncio functions, which is understandable because asyncio is a nightmare of complexity. The short statement is that asyncio uses an event loop, combined with futures and coroutines (in the form of generators) to perform explicit concurrency.

Note that it performs _explicit_ concurrency. You cannot drop a random library into an `asyncio` project and expect it to function correctly. The project needs to have been written from the ground up to understand `asyncio`, or at least to have been wrapped in `asyncio` goodness. `aiohttp` has been written in exactly that manner: requests has not. This means that requests never yields for other coroutines to run, and so they never will. This totally eliminates the advantage of `asyncio`.

There is no plan currently to rewrite requests to use `asyncio`: support is simply not there yet.

If you would like to use something that looks like requests' API, you have one obvious option.:[async-requests](https://github.com/inglesp/async-requests), which has been written for `asyncio`. I don't know, however, whether it is Python 3.4 only or not.

Ultimately, this is not a requests bug. =)


Hi Cory,
thank you very much for your kind explanation and help.

Actually I'm struggling in finding the solution of this problem.
Kind regards.
Marco

2014-09-30 17:50 GMT+02:00 Cory Benfield notifications@github.com:

> This is not a requests bug. =) We do not support asyncio.
> 
> The fact that you attempted this suggests you don't have a full
> understanding of how asyncio functions, which is understandable because
> asyncio is a nightmare of complexity. The short statement is that asyncio
> uses an event loop, combined with futures and coroutines (in the form of
> generators) to perform explicit concurrency.
> 
> Note that it performs _explicit_ concurrency. You cannot drop a random
> library into an asyncio project and expect it to function correctly. The
> project needs to have been written from the ground up to understand
> asyncio, or at least to have been wrapped in asyncio goodness. aiohttp
> has been written in exactly that manner: requests has not. This means that
> requests never yields for other coroutines to run, and so they never will.
> This totally eliminates the advantage of asyncio.
> 
> There is no plan currently to rewrite requests to use asyncio: support is
> simply not there yet.
> 
> If you would like to use something that looks like requests' API, you have
> one obvious option.:async-requests
> https://github.com/inglesp/async-requests, which has been written for
> asyncio. I don't know, however, whether it is Python 3.4 only or not.
> 
> Ultimately, this is not a requests bug. =)
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/kennethreitz/requests/issues/2256#issuecomment-57335553
> .