Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -29,7 +29,11 @@ def create_list_from_template(folder_id, template_id, list_name):
|
|
| 29 |
}
|
| 30 |
}
|
| 31 |
|
|
|
|
|
|
|
| 32 |
response = requests.post(url, headers=headers, json=payload)
|
|
|
|
|
|
|
| 33 |
|
| 34 |
if response.status_code == 200:
|
| 35 |
result = response.json()
|
|
@@ -45,10 +49,14 @@ def send_to_google_sheet(name, email, contractor_type):
|
|
| 45 |
"email": email,
|
| 46 |
"type": contractor_type
|
| 47 |
}
|
|
|
|
| 48 |
try:
|
| 49 |
sheet_response = requests.post(GOOGLE_SHEET_WEBHOOK, json=payload)
|
|
|
|
|
|
|
| 50 |
return sheet_response.json()
|
| 51 |
except Exception as e:
|
|
|
|
| 52 |
return {"error": str(e)}
|
| 53 |
|
| 54 |
@app.post("/video")
|
|
@@ -57,6 +65,8 @@ async def create_video_contractor_list(request: Request):
|
|
| 57 |
list_name = data.get("listName")
|
| 58 |
email = data.get("email")
|
| 59 |
|
|
|
|
|
|
|
| 60 |
if not list_name or not email:
|
| 61 |
return {"error": "Missing 'listName' or 'email' in request"}
|
| 62 |
|
|
@@ -74,6 +84,8 @@ async def create_image_contractor_list(request: Request):
|
|
| 74 |
list_name = data.get("listName")
|
| 75 |
email = data.get("email")
|
| 76 |
|
|
|
|
|
|
|
| 77 |
if not list_name or not email:
|
| 78 |
return {"error": "Missing 'listName' or 'email' in request"}
|
| 79 |
|
|
|
|
| 29 |
}
|
| 30 |
}
|
| 31 |
|
| 32 |
+
print(f"π¦ Sending ClickUp list creation request: {payload}")
|
| 33 |
+
|
| 34 |
response = requests.post(url, headers=headers, json=payload)
|
| 35 |
+
print(f"π¨ ClickUp response status: {response.status_code}")
|
| 36 |
+
print(f"π¨ ClickUp response body: {response.text}")
|
| 37 |
|
| 38 |
if response.status_code == 200:
|
| 39 |
result = response.json()
|
|
|
|
| 49 |
"email": email,
|
| 50 |
"type": contractor_type
|
| 51 |
}
|
| 52 |
+
print(f"π€ Sending data to Google Sheet: {payload}")
|
| 53 |
try:
|
| 54 |
sheet_response = requests.post(GOOGLE_SHEET_WEBHOOK, json=payload)
|
| 55 |
+
print(f"π₯ Google Sheet response status: {sheet_response.status_code}")
|
| 56 |
+
print(f"π₯ Google Sheet response body: {sheet_response.text}")
|
| 57 |
return sheet_response.json()
|
| 58 |
except Exception as e:
|
| 59 |
+
print(f"β Error sending to Google Sheet: {e}")
|
| 60 |
return {"error": str(e)}
|
| 61 |
|
| 62 |
@app.post("/video")
|
|
|
|
| 65 |
list_name = data.get("listName")
|
| 66 |
email = data.get("email")
|
| 67 |
|
| 68 |
+
print(f"π¨ /video endpoint called with: name={list_name}, email={email}")
|
| 69 |
+
|
| 70 |
if not list_name or not email:
|
| 71 |
return {"error": "Missing 'listName' or 'email' in request"}
|
| 72 |
|
|
|
|
| 84 |
list_name = data.get("listName")
|
| 85 |
email = data.get("email")
|
| 86 |
|
| 87 |
+
print(f"π¨ /image endpoint called with: name={list_name}, email={email}")
|
| 88 |
+
|
| 89 |
if not list_name or not email:
|
| 90 |
return {"error": "Missing 'listName' or 'email' in request"}
|
| 91 |
|