Linked Questions

6 votes
1 answer
20k views

This is for a discord bot I am making, using the discord.py API in which basically everything is done in these async functions. Lets say I have an async method thats look like this: async def ...
weeg luigi's user avatar
3 votes
1 answer
5k views

I've written a Python library that currently makes several independent HTTP requests in serial. I'd like to parallelize these requests without altering how the library is called by users, or requiring ...
goodside's user avatar
  • 4,699
5 votes
1 answer
6k views

I'm building an API with FastAPI and Playwright and I'm wondering how I should I write my code. This is Playwright Asyncio: import asyncio from playwright.async_api import async_playwright async def ...
MrGuemez's user avatar
  • 126
0 votes
1 answer
4k views

I am currently trying to import an (selfwritten) async function in python, but the compiler gives me an error message. See the minimalistic example below (yes I know that in this example async does ...
Manuel 's user avatar
  • 807
0 votes
1 answer
2k views

TL;DR: Q: How to lock protect a shared resource from a sync function in py39? Sorry if this was already answered - I just couldn't find it easily. I'm struggling how to correctly await a lock when ...
Steffen Schumacher's user avatar
0 votes
1 answer
2k views

I'm looking to define a new connection as shown here: https://udsoncan.readthedocs.io/en/latest/udsoncan/connection.html#defining-a-new-connection However, I want to call async code from there (i.e. ...
SimpleOne's user avatar
  • 1,096
0 votes
1 answer
1k views

I want to run a coroutine in a different thread and get the result that the coroutine returns. class Main: def __init__(self, result_from_io_task=None): self._io_task_result = ...
user6037143's user avatar
0 votes
2 answers
201 views

This problem is probably not complicated, but I'm new to async library and I just can't figure this out. Let's say I have a synchronous function from which I want to call an async function without ...
elaspog's user avatar
  • 1,729
0 votes
1 answer
180 views

Here's my code: async def random(): return 1, 2 idk1, idk2 = random() print(idk1, idk2) After running, I received the error: cannot unpack non-iterable coroutine object. How can I fix this? Thank ...
raid6n's user avatar
  • 55
0 votes
0 answers
85 views

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 ...
user avatar
0 votes
1 answer
74 views

I'm trying to create helper function for my projects, but some legacy projects are in sync environment. my helper function looks like: def func_for_async_and_sync(session, data): statement = ...
PaleNeutron's user avatar
  • 3,295