{
"msg": "Тема должна быть строкой"
Вот мой код
Код: Выделить всё
@auth_bp.route("/addevent", methods=["POST"])
@jwt_required()
def add_event():
try:
print("Reached endpoint")
user_identity = get_jwt_identity()
access_token = user_identity.get("access_token")
if not access_token:
return jsonify({"error": "No Authorization"}), 401
event_details = request.json
headers = {"Authorization": f"Bearer {access_token}"}
response = requests.post(
"https://www.googleapis.com/calendar/v3/calendars/primary/events",
headers=headers,
json=event_details,
)
return jsonify(response.json()), response.status_code
except Exception as e:
return jsonify({"error": f"Failed to add event: {e}"}), 500
Код: Выделить всё
curl -X POST http://127.0.0.1:5000/api/auth/addevent \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d "{ \
\"summary\": \"Team Meeting\", \
\"location\": \"Zoom\", \
\"description\": \"Weekly sync-up meeting.\", \
\"start\": { \
\"dateTime\": \"2024-12-02T14:00:00-05:00\", \
\"timeZone\": \"America/New_York\" \
}, \
\"end\": { \
\"dateTime\": \"2024-12-02T15:00:00-05:00\", \
\"timeZone\": \"America/New_York\" \
}, \
\"attendees\": [ \
{ \"email\": \"team.member@example.com\" } \
] \
}"
Подробнее здесь: https://stackoverflow.com/questions/792 ... ask-python
Мобильная версия