aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/picoLCD/mrtg.py
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-04-27 19:24:15 +0200
committerReinhard Tartler <siretart@tauware.de>2011-04-27 19:24:15 +0200
commit181cec4348da40331b3e8ab365732c025ec149b2 (patch)
treee2e749be67c8253a8096aaf92aab9c51f1a17f7f /contrib/picoLCD/mrtg.py
downloadlcd4linux-181cec4348da40331b3e8ab365732c025ec149b2.tar.gz
Import upstream version 0.11.0~svn1143
Diffstat (limited to 'contrib/picoLCD/mrtg.py')
-rw-r--r--contrib/picoLCD/mrtg.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/contrib/picoLCD/mrtg.py b/contrib/picoLCD/mrtg.py
new file mode 100644
index 0000000..e501ca9
--- /dev/null
+++ b/contrib/picoLCD/mrtg.py
@@ -0,0 +1,21 @@
+import urllib
+import shutil
+
+download_path = "/tmp/"
+
+def saveimage(imageurl):
+ filename = imageurl.split('/')[-1]
+ tmpname = filename + ".tmp"
+ try:
+ urllib.urlretrieve(imageurl, download_path + tmpname)
+ except IOError:
+ return "Error downloading file"
+ else:
+ shutil.move(download_path + tmpname, download_path + filename)
+ return download_path + filename
+
+
+#saveimage("http://www.switch.ch/network/operation/statistics/geant2-day.png")
+#saveimage("http://192.168.12.113/mrtg/127.0.0.1_2-day.png")
+
+