half-typing is not my passion

This commit is contained in:
2025-12-23 01:01:25 +02:00
parent caab5e6ea9
commit 912cd08660
2 changed files with 6 additions and 4 deletions

View File

@@ -150,11 +150,12 @@ async def view_longpoll(request):
await response.send("data: watch-stream-opened\n\n") await response.send("data: watch-stream-opened\n\n")
async for event in stream: async for event in stream:
ev = event["fullDocument"] ev = event["fullDocument"]
if ev["approved"] != "true": if not ev["approved"]:
continue continue
if ev["type"] == "card": if ev["method"] == "card":
continue continue
print("realtime opening %s" % ev["door"])
response.send("data: %s\n\n" % ev["door"]) response.send("data: %s\n\n" % ev["door"])
except PyMongoError as e: except PyMongoError as e:
print(e) print(e)

View File

@@ -7,6 +7,7 @@ import requests
from pymongo.errors import PyMongoError from pymongo.errors import PyMongoError
from requests.exceptions import RequestException from requests.exceptions import RequestException
from sanic import Blueprint from sanic import Blueprint
from sanic.response import text
slack_app = Blueprint("slack", __name__) slack_app = Blueprint("slack", __name__)
@@ -133,4 +134,4 @@ async def slack_open(request):
} }
) )
return f"Opening {door}" return text(f"Opening {door}")