Since I was able to save the temperature and humidity data in a text file with Raspberry Pi, This time I tried to see if I could upload it to a rental server on a regular basis.
By the way, the rental server I tried was It was "Star Server Free". I was able to upload without any problems.
import ftplib
def ftp_upload(filename):
  ftp = ftplib.FTP('Server hostname')
  ftp.set_pasv('true')
  ftp.login('username','password')
  ftp.cwd('/rp/')
  f = open(filename,'rb')
  ftp.storbinary('STOR ' + filename, f)
  f.close()
ftp_upload('data.txt')
Text data that accumulates at regular intervals, such as temperature and humidity data, is Should I manage it with MySQL instead of a text file?
Recommended Posts