mirror of
https://github.com/netfun2000/lcd4linux.git
synced 2026-02-27 09:44:34 +08:00
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@986 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
22 lines
507 B
Python
22 lines
507 B
Python
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")
|
|
|
|
|