[email] Send message with requests instead of curl

This commit is contained in:
maike 2020-07-06 21:41:22 +02:00 committed by dl6tom
parent 43b8ec8373
commit cdd5d3b3a8

View file

@ -3,9 +3,9 @@
# SPDX-License-Identifier: 0BSD
import email.parser
import json
import sys
import re
import requests
from logging import getLogger
from kibicara.platforms.email.model import Email
@ -38,11 +38,4 @@ def main():
'author': mail.get_unixfrom(),
'secret': Email.secret,
}
# 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)
)
requests.post('http://localhost/api/email/messages/', data=body)