# Generate charts from WHO updates on Influenza A(H1N1) # # Copyright (C) 2009 http://www.vyvy.org/ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # # Notes: # - This program relies on uncaught exceptions for very simple error handling! # # 11-Jul-09: First working version # 28-Jul-09: Added the handling of death cases import os import ftplib # Generate and preview charts print('Generating charts...') os.system('gnuplot h1n1_malaysia.gp') print('Previewing charts...') os.system('display h1n1_malaysia_confirmed.png') os.system('display h1n1_malaysia_death.png') # Upload files via FTP print('Uploading files to webpage...') print(' Logging in...') ftp = ftplib.FTP() ftp.connect('vyvy.org') username = input('Username? ') # You think I will write this down? password = input('Password? ') # You think I will just give you this??? ftp.login(username, password) ftp.cwd('public_html/main/sites/vyvy.org/files/') filenames = [ 'h1n1_malaysia_confirmed.png', 'h1n1_malaysia_death.png', 'h1n1_malaysia.gp', 'h1n1_malaysia.gpdat', ] for filename in filenames: print(" Transferring '" + filename + "'...") with open(filename, mode='rb') as fp: ftp.storbinary('STOR ' + filename, fp) ftp.quit() print('Done!')