2022-04-03 21:39:26 +03:00
|
|
|
import requests
|
|
|
|
|
|
|
|
# Headers for login to Akf-forum
|
|
|
|
headers = {
|
|
|
|
"username": "testUser",
|
|
|
|
"password": "testPassword"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Body for message parameters
|
|
|
|
body = {
|
|
|
|
"content": "This message sent via API",
|
2022-04-06 21:14:46 +03:00
|
|
|
"threadID": 0
|
2022-04-03 21:39:26 +03:00
|
|
|
}
|
|
|
|
|
2022-04-03 22:03:47 +03:00
|
|
|
r = requests.post("http://localhost:3000/api/messages/",
|
2022-04-03 21:39:26 +03:00
|
|
|
headers=headers, data=body)
|
|
|
|
|
|
|
|
print(r.json())
|
|
|
|
|
|
|
|
example_response = {
|
|
|
|
'status': 200,
|
|
|
|
'result': {
|
|
|
|
'content': 'This message sent via API',
|
|
|
|
'author': {
|
|
|
|
'name': 'testUser',
|
|
|
|
'avatar': '',
|
|
|
|
'time': 1649009854217,
|
|
|
|
'admin': False,
|
|
|
|
'deleted': False,
|
2022-08-11 01:11:07 +03:00
|
|
|
'id': "2"
|
2022-04-03 21:39:26 +03:00
|
|
|
},
|
|
|
|
'time': 1649010863471,
|
2022-08-11 01:11:07 +03:00
|
|
|
'threadID': "1",
|
2022-04-03 21:39:26 +03:00
|
|
|
'deleted': False,
|
|
|
|
'edited': False,
|
|
|
|
'react': {},
|
2022-08-11 01:11:07 +03:00
|
|
|
'id': "6"
|
2022-04-03 21:39:26 +03:00
|
|
|
}
|
|
|
|
}
|