[email] Send message with requests instead of curl
This commit is contained in:
parent
43b8ec8373
commit
cdd5d3b3a8
|
@ -3,9 +3,9 @@
|
||||||
# SPDX-License-Identifier: 0BSD
|
# SPDX-License-Identifier: 0BSD
|
||||||
|
|
||||||
import email.parser
|
import email.parser
|
||||||
import json
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
import requests
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from kibicara.platforms.email.model import Email
|
from kibicara.platforms.email.model import Email
|
||||||
|
|
||||||
|
@ -38,11 +38,4 @@ def main():
|
||||||
'author': mail.get_unixfrom(),
|
'author': mail.get_unixfrom(),
|
||||||
'secret': Email.secret,
|
'secret': Email.secret,
|
||||||
}
|
}
|
||||||
|
requests.post('http://localhost/api/email/messages/', data=body)
|
||||||
# POST request mit API-key und JSON-body an /api/email/messages/:
|
|
||||||
print(
|
|
||||||
"curl "
|
|
||||||
"-X POST http://localhost/api/email/messages/ "
|
|
||||||
"-H 'Content-Type: application/json' "
|
|
||||||
"-d " + json.dumps(body)
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in a new issue