You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by jrobbins-LiveData March 20, 2022
The Mangum doc shows this example of how one might handle a custom event:
defhandler(event, context):
ifevent.get("some-key"):
# Do something or return, etc.returnasgi_handler=Mangum(app)
response=asgi_handler(event, context) # Call the instance with the event argumentsreturnresponse
I need to handle an incoming AWS EventBridge event. I want to invoke the same method that my HTTP API handler is also invoking -- and it is an async method.
My question(s): Is this the correct pattern to use? In the Mangum source, I see code like this, so I am trying to fit in. My code seems to work, but I read in the Python docs that get_event_loop() is
Deprecated since version 3.10: Deprecation warning is emitted if there is no running event loop. In future Python releases, this function will be an alias of get_running_loop().
Which made me wonder if I were doing this correctly?
The text was updated successfully, but these errors were encountered:
To be clear, in the simplest case of a Lambda function with a Mangum-based app (e.g. using FastAPI), there only needs to be one event loop, not multiple event loops. The only issue is making it explicit as to whom is responsible for creating the asyncio event loop. The discussion has details of how we might address this.
Discussed in #256
Originally posted by jrobbins-LiveData March 20, 2022
The Mangum doc shows this example of how one might handle a custom event:
I need to handle an incoming AWS EventBridge event. I want to invoke the same method that my HTTP API handler is also invoking -- and it is an async method.
Here's what I am using
My question(s): Is this the correct pattern to use? In the Mangum source, I see code like this, so I am trying to fit in. My code seems to work, but I read in the Python docs that
get_event_loop()
isWhich made me wonder if I were doing this correctly?
The text was updated successfully, but these errors were encountered: