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 32 33 34 35 36
| #!/usr/bin/python
# -*- coding: iso8859-15 -*-#
import ftplib as ftp # on importe et renomme juste pour le script en "ftp"
import traceback
import time
def numdemiheure() :
a= int(time.strftime('%H',time.localtime()))
b= int(time.strftime('%M',time.localtime()))
if a<7 :
a=0
else :
a=(a-7)*2 + b//30 +1
return a
flagphoto =0
debutprog = time.localtime()
while numdemiheure() < 12 :
avno=numdemiheure()
if flagphoto==0 and numdemiheure()>0 :
print("Sauvegarde ftp ")
ftp = ftp.FTP("ftpperso.free.fr")
try:
try:
ftp.login("xxxx", "zzzzz")
file = open("0003.jpg", 'rb')
ftp.storbinary('STOR '+"0033.JPG", file)
file.close()
finally:
print("Quitting...")
except:
traceback.print_exc()
if avno!=numdemiheure() :
flagphoto=0 |
Partager