Guest User

FTP RasPiCam

a guest
Dec 1st, 2014
194
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/ usr / bin/ python
  2. # coding =utf -8
  3. import time , sys
  4. import picamera
  5. import ftplib
  6. cam = picamera . PiCamera ()
  7. def upload ():
  8.     session = ftplib . FTP('ftp . beispiel . com ',' ftp_username@domain .de ', ' PASSWORD ')
  9.     directory = "/ PFAD_AUF_DEM_SERVER "
  10.     session .cwd ( directory )
  11.     file = open ('bild . jpg ','rb ')
  12.     session . storbinary ('STOR bild . jpg ', file )
  13.     file . close ()
  14.     session . quit ()
  15.     return
  16. try:
  17.     while True :
  18.         cam . capture ('bild . jpg ')
  19.         time . sleep (1)
  20.         upload ()
  21. except KeyboardInterrupt :
  22.     cam . close ()
  23.     sys . exit ()
RAW Paste Data