Spaces:
Runtime error
Runtime error
another try reading webhook json
Browse files14 unmodified lines151617181920192 unmodified lines21321421521621721821914 unmodified linesfrom specklepy.objects.geometry import Polyline, Pointfrom huggingface_hub import webhook_endpoint, WebhookPayloadimport requestsimport datetime192 unmodified lines# Function to run on button click@webhook_endpoint # Define a unique endpoint URLasync def update_streams():print("trying to print request msg")speckle_token = os.environ.get("SPECKLE_TOKEN")notion_token = os.environ.get("NOTION_TOKEN")14 unmodified lines15161718192021192 unmodified lines21421521621721821922022122222322422522622722822923023123223323423523623714 unmodified linesfrom specklepy.objects.geometry import Polyline, Pointfrom huggingface_hub import webhook_endpoint, WebhookPayloadfrom fastapi import Requestimport requestsimport datetime192 unmodified lines# Function to run on button click@webhook_endpoint # Define a unique endpoint URLasync def update_streams(request: Request):# Read the request body as JSONpayload = await request.json()# Extract data from the payloadstream_id = payload.get('streamId')user_id = payload.get('userId')activity_message = payload.get('activityMessage')# Accessing nested data in the 'event' objectevent_name = payload['event']['event_name']old_data = payload['event']['data']['old']new_data = payload['event']['data']['new']# Example of using the extracted dataprint(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