-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.py
31 lines (25 loc) · 978 Bytes
/
email.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests as r
from config import APIKEY, BASEURL
import logging, sys, csv
import configparser
config = configparser.ConfigParser()
config.read("setup.ini")
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[logging.FileHandler("debug.log"), logging.StreamHandler(sys.stdout)],
encoding="utf-8",
)
header = {"Authorization": f"Token {APIKEY}", "Content-Type": "application/json"}
payload = {
"mail_password": config['mail']['mailPassword'],
"mail_port": config['mail']['mailPort'],
"mail_server": config['mail']['mailServer'],
"mail_ssl": config["mail"].getboolean('mailSSL'),
"mail_tls": config["mail"].getboolean('mailTLS'),
"mail_useauth": config["mail"].getboolean('mailAUTH'),
"mail_username": config["mail"]["mailUsername"],
"mailfrom_addr": config["mail"]["mailFromAddress"]
}
a = r.patch(f"{BASEURL}api/v1/configs", headers=header, json=payload)
print(a.text)