This repository was archived by the owner on Dec 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from .chat_cmd .main import process_chat_message
2+ from .lambda_handler import lambda_handler
3+
4+ __all__ = [
5+ 'process_chat_message' ,
6+ 'lambda_handler'
7+ ]
Original file line number Diff line number Diff line change 1+ import json
2+ from .server import app as application
3+
4+
5+ def lambda_handler (event , context ):
6+ with application .test_client () as client :
7+ http_method = event ['httpMethod' ]
8+ path = event ['path' ]
9+ headers = event .get ('headers' , {})
10+ query_string = event .get ('queryStringParameters' , {})
11+ body = event .get ('body' , '' )
12+
13+ if body :
14+ body = json .loads (body )
15+
16+ response = client .open (
17+ path ,
18+ method = http_method ,
19+ headers = headers ,
20+ query_string = query_string ,
21+ json = body
22+ )
23+
24+ return {
25+ 'statusCode' : response .status_code ,
26+ 'body' : response .data .decode ('utf-8' ),
27+ 'headers' : dict (response .headers )
28+ }
You can’t perform that action at this time.
0 commit comments