From cdd5d3b3a84be38e6bc9fc4ec6f719017c1a8648 Mon Sep 17 00:00:00 2001 From: maike Date: Mon, 6 Jul 2020 21:41:22 +0200 Subject: [PATCH] [email] Send message with requests instead of curl --- kibicara/kibicara_mda.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/kibicara/kibicara_mda.py b/kibicara/kibicara_mda.py index 9ffc00f..6e748ba 100644 --- a/kibicara/kibicara_mda.py +++ b/kibicara/kibicara_mda.py @@ -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)