![](https://secure.gravatar.com/avatar/7e9c74111f9637bf4062467a137544ae.jpg?s=120&d=mm&r=g)
Hi. I'm trying to make sans-io library. 1. Protocol works over http, so I've just passing Request object with method, url, data, etc. fields to user and receive Response object (json in this case). 2. I'm using generators for simplification of holding state of multirequest actions. Something like this: def login(): response = yield Request(...) # check server state # update state with response response = yield Request(...) # actually login yield None def act(generator): response = None while True: request = generator.send(response) if request is None: return response response = # do io act(login()) This solve problem multistep actions. The downside is that all your protocol functions, event if they have only one request and don't need response at all, must be generators. Is it ok to send just abstract Request and receive abstract Response (not just bytes)? Is there a better solution for multirequest actions?