#๐Ÿ”’ hi need help in my faspapi please help

10 messages ยท Page 1 of 1 (latest)

glacial locust
#
import contexlib

@asynccontextmanager
async def lifespan(app: FastAPI):
    async with redis.from_url("redis://localhost:6379/1") as redis_pool:
        with contextlib.closing(await get_async_clickhouse_client()) as clickhouse_pool:
            print("start")
            yield {
                "redis_pool": redis_pool,
                "clickhouse_pool": clickhouse_pool
            }
            print("end")
jagged finchBOT
#

@glacial locust

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

glacial locust
#

@midnight nova hi bro

#

you state this Looks like it's not exposed by the libraries can you plase guide.

cobalt pine
#

so, what exactly is the problem you're having?

#

also, why are you yielding a dict there? I haven't seen that in a lifespan function before, looking at the docs, I don't see something like that mentioned there either, are you trying to store those 2 variables in the app state?

cinder echo
#

import contexlib is spelled wrong.

#

Idk if that's the issue, but it'll be a issue if that's your actual code.

jagged finchBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.