Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1
    Don't put the event loop in an async code block, async code must be run by the event loop, not the other way around. Commented Dec 28, 2016 at 9:56
  • Thanks! Surely, I'm missing something here. All event loop examples I have seen use loop.run_until_complete(get_api_results()) which in my understanding would both make the call blocking and lose the results. Commented Dec 28, 2016 at 10:01
  • You normally would have more coroutines handling the results, with the event loop driving those. Commented Dec 28, 2016 at 10:02
  • also, requests.get() is a blocking call, not something you can await on. Commented Dec 28, 2016 at 10:06
  • Yes, that's why I wrapped it in loop.run_in_executor() as suggested in stackoverflow.com/questions/22190403/… Commented Dec 28, 2016 at 10:10