Browse Source

Add ISP and user name to the email

master
John Smith 3 weeks ago
parent
commit
4219128644
  1. 6
      speedtest.py

6
speedtest.py

@ -75,9 +75,8 @@ def get_client(config: ConfigParser):
return client return client
def send_data(config: ConfigParser, body: str, messages: list): def send_data(config: ConfigParser, email_content: str, messages: list):
client = get_client(config) client = get_client(config)
email_content = ""
for message in messages: for message in messages:
if not message.contents: if not message.contents:
continue continue
@ -93,7 +92,6 @@ def send_data(config: ConfigParser, body: str, messages: list):
texts = body.text texts = body.text
for text in texts: for text in texts:
content_, args = text.content, text.args content_, args = text.content, text.args
print("args", args)
email_content += content_.format(*text.args) email_content += content_.format(*text.args)
email_content += "\n" email_content += "\n"
@ -230,7 +228,7 @@ def main():
raise RuntimeError("No tests performed!") raise RuntimeError("No tests performed!")
client = get_client(mail_section) client = get_client(mail_section)
body = "User name: %s; ISP: %s" % (name, isp) body = "# User name: %s; ISP: %s\n" % (name, isp)
send_data(mail_section, body, messages) send_data(mail_section, body, messages)
logger.info("Done! You're amazing!") logger.info("Done! You're amazing!")

Loading…
Cancel
Save