Nikolay,

thanks for your response.
Sorry, I should have been more specific.

I have already tried this:
data = yield from payload.read(2)
And got this:
TypeError: read() takes 1 positional argument but 2 were given

So I assumed that I used the wrong object.
Now you tell me that I did use the correct object.

So my question basically boils down to:
How am I supposed to read n bytes from the stream?

IMHO read(n) or its cousin recv(n) are the most basic stream interfaces 
that exists.
Any functions and libraries that I can reuse from the synchronous world do 
expect a read(n) or recv(n) method that reads n bytes from the stream.

Regards
Holger

Am Sonntag, 5. Januar 2014 23:58:33 UTC+1 schrieb Nikolay Kim:
>
> Holger, 
>
> payload is a DataQueue object. you can do ‘data = yield from 
> payload.read()’, empty data means eof. 
>
> On Jan 5, 2014, at 2:15 PM, Holger Waldmann <[email protected]<javascript:>> 
> wrote: 
>
> > If this is not the right place to discuss aiohttp then please say so. 
> > 
> > I had a look into aiohttp and after the simple hello world example 
> immediately hit the following problem: 
> > I cannot find a way to read the request body from within the request 
> handler. 
> > The handler is an asyncio.coroutine so I expect to find a method that I 
> can yield from to read the data: 
> >     data = yield from X.read(n) # or recv(n) or read_bytes(n) or 
> whatever... 
> > Where X is either an attribute of the message object or the payload 
> object. 
> > 
> > How is it supposed to be done? 
> > 
> > Regards 
> > Holger 
> > 
>
>

Reply via email to