Skip to content

Commit a5b55de

Browse files
📝 add documentation to create scope function
1 parent 2b71225 commit a5b55de

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": ".venv/bin/python"
3+
}

mangum/adapter.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ def __call__(self, event: dict, context: "LambdaContext") -> dict:
106106
return response
107107

108108
def _create_scope(self, event: dict, context: "LambdaContext") -> Scope:
109+
"""Creates a scope object according to ASGI specification from a Lambda Event.
110+
111+
https://asgi.readthedocs.io/en/latest/specs/www.html#http-connection-scope
112+
113+
The event comes from various sources: AWS ALB, AWS API Gateway of different
114+
versions and configurations(multivalue header, etc).
115+
Thus, some heuristics is applied to guess an event type.
116+
117+
"""
109118
request_context = event["requestContext"]
110119

111120
if event.get("multiValueHeaders"):

0 commit comments

Comments
 (0)