-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Hi. I'm writing an application that scrapes events from a website and is supposed to publish them to Spond.
I'm having trouble publishing an event on Spond. Maybe someone here was successful doing what I'm trying to do.
I thought I had figured out the payload format but I keep getting 415s.
I double checked the payload format a million times and when executing in curl I can successfully publish an event in Spond. I'm thinking it might be an issue with headers. But judging from the implementation of send_message() in this lib I don't see any additional headers that are supposed to be sent when interacting with this API. Anyone got an idea what I'm doing wrong?
Once figured out I'd love to contribute to this lib.
payload (resulting from code below)
{
"heading": "test 1234566",
"spondType": "event",
"startTimestamp": "2022-11-19T23:00:00.000Z",
"openEnded": true,
"commentsDisabled": false,
"maxAccepted": 0,
"rsvpDate": null,
"location": null,
"owners": [
{
"id": "351D270163564DBEA4F91A0761102F1A"
}
],
"visibility": "INVITEES",
"participantsHidden": false,
"autoReminderType": "DISABLED",
"autoAccept": false,
"attachments": [],
"type": "EVENT",
"tasks": {
"openTasks": [],
"assignedTasks": []
},
"recipients": {
"groupMembers": [
"351D270163564DBEA4F91A0761102F1A",
"CAACE6F796AE4C279943861CD6D569B2"
],
"group": {
"id": "DD14208A27E34B2B93519977D79B8F16"
}
}
}
code
if not self.spond.cookie:
await self.spond.login()
url = self.spond.apiurl + 'sponds'
event_data = {
'heading': event['title'],
'spondType': 'event',
# 'startTimestamp': event['date'].strftime(SPOND_DATETIME_FORMAT),
'startTimestamp': '2022-11-19T23:00:00.000Z',
'openEnded': True,
'commentsDisabled': False,
'maxAccepted': 0,
'rsvpDate': None,
'location': None,
'owners': [
{
'id': self.client_account_id
}
],
'visibility': 'INVITEES',
'participantsHidden': False,
'autoReminderType': 'DISABLED',
'autoAccept': False,
'attachments': [],
'type': 'EVENT',
'tasks': {
'openTasks': [],
'assignedTasks': []
},
'recipients': {
'groupMembers': member_ids,
'group': {
'id': self.group_id
}
}
}
headers = {'auth': self.spond.auth}
res = await self.spond.clientsession.post(url, data=event_data, headers=headers)