Spaces:
Runtime error
Runtime error
another try reading webhook json
Browse files14 unmodified lines15161718192021192 unmodified lines21421521621621721821922022122222322422522622722822923023123223323423523623714 unmodified linesfrom specklepy.objects.geometry import Polyline, Point
from huggingface_hub import webhook_endpoint, WebhookPayloadfrom fastapi import Request
import requestsimport datetime192 unmodified lines
# Function to run on button click@webhook_endpoint # Define a unique endpoint URLasync def update_streams():async def update_streams(request: Request): # Read the request body as JSON payload = await request.json()
# Extract data from the payload stream_id = payload.get('streamId') user_id = payload.get('userId') activity_message = payload.get('activityMessage')
# Accessing nested data in the 'event' object event_name = payload['event']['event_name'] old_data = payload['event']['data']['old'] new_data = payload['event']['data']['new']
# Example of using the extracted data print(f"Event Name: {event_name}") print(f"Old Stream Name: {old_data['name']}") print(f"New Stream Description: {new_data['description']}") print("trying to print request msg") speckle_token = os.environ.get("SPECKLE_TOKEN") notion_token = os.environ.get("NOTION_TOKEN")app.py+19-1