Spaces:
Sleeping
Sleeping
Commit ·
7f54d7e
1
Parent(s): 71c15e2
console log debug
Browse files- tools/wordpress_post.py +7 -1
tools/wordpress_post.py
CHANGED
|
@@ -44,14 +44,20 @@ class WordPressPostTool(Tool):
|
|
| 44 |
"status": status
|
| 45 |
}
|
| 46 |
|
|
|
|
|
|
|
|
|
|
| 47 |
try:
|
| 48 |
response = requests.post(api_url, json=data, auth=auth)
|
| 49 |
response.raise_for_status()
|
| 50 |
response_data = response.json()
|
| 51 |
-
|
| 52 |
"status": "success",
|
| 53 |
"post_id": response_data.get("id"),
|
| 54 |
"post_url": response_data.get("link")
|
| 55 |
}
|
|
|
|
|
|
|
| 56 |
except requests.exceptions.RequestException as e:
|
|
|
|
| 57 |
return {"error": f"Failed to publish post: {str(e)}"}
|
|
|
|
| 44 |
"status": status
|
| 45 |
}
|
| 46 |
|
| 47 |
+
print(f"api_url: {api_url}")
|
| 48 |
+
print(f"auth: {auth}")
|
| 49 |
+
print(f"data: {data}")
|
| 50 |
try:
|
| 51 |
response = requests.post(api_url, json=data, auth=auth)
|
| 52 |
response.raise_for_status()
|
| 53 |
response_data = response.json()
|
| 54 |
+
response_returned = {
|
| 55 |
"status": "success",
|
| 56 |
"post_id": response_data.get("id"),
|
| 57 |
"post_url": response_data.get("link")
|
| 58 |
}
|
| 59 |
+
print(f"Post published successfully: {response_returned}")
|
| 60 |
+
return response_returned
|
| 61 |
except requests.exceptions.RequestException as e:
|
| 62 |
+
print(f"Failed to publish post: {str(e)}")
|
| 63 |
return {"error": f"Failed to publish post: {str(e)}"}
|