cbensimon HF staff commited on
Commit
0d68e6c
·
1 Parent(s): 422feae

Webhook route

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -2,10 +2,18 @@
2
  """
3
 
4
  from fastapi import FastAPI
 
5
 
6
 
 
 
7
  app = FastAPI()
8
 
9
  @app.get("/")
10
- def read_root():
11
- return {"Hello": "World"}
 
 
 
 
 
 
2
  """
3
 
4
  from fastapi import FastAPI
5
+ from fastapi import Request
6
 
7
 
8
+ events = []
9
+
10
  app = FastAPI()
11
 
12
  @app.get("/")
13
+ async def get_events():
14
+ return events
15
+
16
+ @app.post("/webhook")
17
+ async def webhook(request: Request):
18
+ global events
19
+ events += [await request.json()]