Spaces:
Runtime error
Runtime error
added logic to update only stream the webhook was sent front
Browse files218 unmodified lines2192202212222232242253 unmodified lines229230231232233234235236237238239240218 unmodified linespayload = await request.json()print(str(payload))# Accessing nested data in the 'event' object3 unmodified lines#client = SpeckleClient(host="https://speckle.xyz")#client.authenticate_with_token(token=speckle_token)for key, value in streams.items():stream_id = value["stream"]notion_db = value["notionDB"]branch_data = extract_branch_info(stream_id, server_url="https://speckle.xyz/", token=speckle_token)sync_to_notion(notion_token, notion_db, branch_data)return "All streams updated successfully!"218 unmodified lines2192202212222232242253 unmodified lines229230231232233234235236237238239240241242243244245246247248249250251252253254218 unmodified linespayload = await request.json()print(str(payload))# Accessing nested data in the 'event' object3 unmodified lines#client = SpeckleClient(host="https://speckle.xyz")#client.authenticate_with_token(token=speckle_token)if 'payload' in payload and 'stream' in payload['payload']:stream_info = payload['payload']['stream']if 'name' in stream_info:stream_name = stream_info['name']print("update dat for: " + stream_name)# retrieve specific streamstream_id = streams[stream_name]["stream"]notion_db = streams[stream_name]["notionDB"]branch_data = extract_branch_info(stream_id, server_url="https://speckle.xyz/", token=speckle_token)sync_to_notion(notion_token, notion_db, branch_data)else:print("updating data for all streams")for key, value in streams.items():stream_id = value["stream"]notion_db = value["notionDB"]branch_data = extract_branch_info(stream_id, server_url="https://speckle.xyz/", token=speckle_token)sync_to_notion(notion_token, notion_db, branch_data)return "All streams updated successfully!"
app.py+20-6