Spaces:
Runtime error
Runtime error
File size: 580 Bytes
c2f31df a18602d c2f31df 0d68e6c c2f31df a18602d c2f31df 0d68e6c a18602d 0d68e6c a18602d 654fde1 2636cc8 654fde1 a18602d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
"""
"""
import re
from fastapi import FastAPI
from fastapi import Request
app = FastAPI()
urls = []
url_re = re.compile(r'https://s3\.amazonaws\.com/moonup/production/uploads/\d+-noauth\.jpeg')
@app.get("/")
async def get_events():
return urls
@app.post("/webhook")
async def webhook(request: Request):
global urls
payload = await request.json()
event = payload["event"]
if event["action"] != "create":
return
if event["scope"] != "discussion":
return
content = payload["comment"]["content"]
urls += url_re.findall(content)
|