Update app.py
Browse files
app.py
CHANGED
|
@@ -80,23 +80,11 @@ async def track_ip(request: Request):
|
|
| 80 |
# -------- Send to Google Sheet --------
|
| 81 |
try:
|
| 82 |
async with httpx.AsyncClient(timeout=5, follow_redirects=True) as client:
|
| 83 |
-
|
| 84 |
GOOGLE_SHEET_WEBHOOK,
|
| 85 |
json=payload,
|
| 86 |
headers={"Content-Type": "application/json"}
|
| 87 |
)
|
| 88 |
-
|
| 89 |
-
print("Status:", response.status_code)
|
| 90 |
-
print("Response:", response.text)
|
| 91 |
-
|
| 92 |
-
# Try JSON safely
|
| 93 |
-
try:
|
| 94 |
-
print("Sheet JSON:", response.json())
|
| 95 |
-
except Exception:
|
| 96 |
-
pass
|
| 97 |
-
|
| 98 |
-
except httpx.RequestError as e:
|
| 99 |
-
print("HTTPX error:", e)
|
| 100 |
except Exception as e:
|
| 101 |
print("Sheet error:", e)
|
| 102 |
|
|
|
|
| 80 |
# -------- Send to Google Sheet --------
|
| 81 |
try:
|
| 82 |
async with httpx.AsyncClient(timeout=5, follow_redirects=True) as client:
|
| 83 |
+
await client.post(
|
| 84 |
GOOGLE_SHEET_WEBHOOK,
|
| 85 |
json=payload,
|
| 86 |
headers={"Content-Type": "application/json"}
|
| 87 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
except Exception as e:
|
| 89 |
print("Sheet error:", e)
|
| 90 |
|