WingNews logo WingNews
top | new | best | ask | show | jobs
top | item 44760903

(no title)

e1gen-v | 7 months ago

I do this in fast api and then pass get_whatever as a dependency to an endpoint

discuss

order

whilenot-dev|7 months ago

Alternatively you could make use of the lifespan[0] and its state[1][2].

[0]: https://fastapi.tiangolo.com/advanced/events/#lifespan-funct...

[1]: https://asgi.readthedocs.io/en/latest/specs/lifespan.html#li...

[2]: https://www.starlette.io/lifespan/#lifespan-state

powered by hn/api // news.ycombinator.com