Kaynağa Gözat

automatische range

tsi 3 yıl önce
ebeveyn
işleme
29525882a3
1 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 5 5
      send_email.py

+ 5 - 5
send_email.py

@@ -3,8 +3,8 @@ from datetime import datetime, timedelta
 
 
 tmpdir = tempfile.TemporaryDirectory() 
-beginning = str((1000*int(time.time()))-(17*3600000))
-end = str(1000*int(time.time()))
+beginning = str(1000*(int(time.time()))-(17*3600000))[:-3]
+end = str(1000*int(time.time()))[:-3]
 
 def get_boot_time():
     with open('/proc/uptime', 'r') as f:
@@ -22,9 +22,9 @@ get_boot_time()
 
 # Send an HTML email with an embedded image and a plain text message for
 # email clients that don't want to display the HTML.
-urllib.request.urlretrieve("http://localhost/cacti/graph_image.php?local_graph_id=109&graph_start=1657999980&graph_end=1658086115&graph_width=700&graph_height=200", tmpdir.name + "/ping.png")
+urllib.request.urlretrieve("http://localhost/cacti/graph_image.php?local_graph_id=109&graph_start=" + beginning + "&graph_end=" + end + "&graph_width=700&graph_height=200", tmpdir.name + "/ping.png")
 
-urllib.request.urlretrieve("http://localhost/cacti/graph_image.php?local_graph_id=103&graph_start=1658000546&graph_end=1658086946&graph_width=695&graph_height=198", tmpdir.name + "/traffic.png")
+urllib.request.urlretrieve("http://localhost/cacti/graph_image.php?local_graph_id=103&graph_start=" + beginning + "&graph_end=" + end + "&graph_width=695&graph_height=198", tmpdir.name + "/traffic.png")
 
 
 from email.mime.multipart import MIMEMultipart
@@ -33,7 +33,7 @@ from email.mime.image import MIMEImage
 
 # Define these once; use them twice!
 strFrom = 'pv-tannenstr@web.de'
-strTo = ["tobias.siegel@outlook.com", "wsiegel@web.de"]
+strTo = ["tobias.siegel@outlook.com"] #, "wsiegel@web.de"]
 
 # Create the root message and fill in the from, to, and subject headers
 msgRoot = MIMEMultipart('related')