0

I need to use a Python library that handles requests through the API of a web service. This library is an asyncio supported library. So I can't use it in a Django view by following the traditional and appropriate ways..

So what should I do to overcome this issue? I just thought that I can create a .py script and it would handle this library and I would use it in my Django view with os.system('...py') but it just looks awful.

Could you help me to find a way that looks just "normal"?

  • 1
    I'm not sure if that's what you're asking about, but you could try to run your async code from the synchronous request handler using one of the methods described in e.g. https://stackoverflow.com/questions/51762227/how-to-call-a-async-function-from-a-synchronized-code-python – Tomasz Zieliński Jun 03 '19 at 19:50
  • I'm currently working on implementing such a way instructed in the link you gave. No success so far but it looks quite useful for my situation too. I need some time. Thanks. –  Jun 03 '19 at 22:22

0 Answers0