from dbupload import upload_file from getpass import getpass email = raw_input("Enter Dropbox email address:") password = getpass("Enter Dropbox password:"******"example.py", "/", "dbupload_test.txt", email, password) print("Uploaded dbupload_test.txt to the root of your Dropbox")
# Countries missing include Iceland, Guatemala, Kenya, Yemen, Palestine, Puerto Rico, Serbia... #put a timestamp on the sheet, so readers know when it was last updated: ws=wb.get_sheet_by_name(UPDATE_DATE_CELL['sheet']) ws.cell(UPDATE_DATE_CELL['cell']).value = asctime() wb.save(XL_OUTFILE) print "wrote to {0}".format(XL_OUTFILE) #=============================================================================== # Upload to Dropbox #=============================================================================== print "uploading file to dropbox..." upload_file(XL_OUTFILE, DROPBOX_FILE, XL_OUTFILE, DROPBOX_EMAIL, DROPBOX_PASSWORD) print "Successfully uploaded to Dropbox!" """ #=============================================================================== # APPENDIX: code you probably don't have to worry about, but might be useful someday. # Contains: # 0. Attempt to upload autommatically to google drive # 1. Code to execute a mysql script with more than one statement. # 2. code to try to fix a "_mysql image not found" error. # 3. Instructions for installing dependencies, if the ones I included in the package fail #===============================================================================
import subprocess from dbupload import upload_file #Used for Dropbox uploading from datetime import datetime # Used the genreate the filename count = 0 #Counts the number of files that have been dumped while True: count = count + 1 fileName = str(datetime.now().day) + "-" + str(datetime.now().month) + "-" + str(datetime.now().year) + " AT " + str(datetime.now().hour) + "-" + str(datetime.now().minute) tcpDumpProcess = subprocess.Popen(["tcpdump", "-Z", "root", "-w", fileName, "-i", "bridge0", "-G", "60", "-W", "1"]) #Sets up the TCPDump command tcpDumpProcess.communicate() #Runs the TCPDump command print "Currently dumping file number " + str(count) + "." upload_file(fileName,"/",fileName, "YOUR_EMAIL","YOUR_PASSWORD") #Uploads the dump file to dropbox print "File uploaded Successfully"
from dbupload import upload_file from getpass import getpass email = raw_input("Enter Dropbox email address:") password = getpass("Enter Dropbox password:"******"example.py","/","dbupload_test.txt",email,password) print("Uploaded dbupload_test.txt to the root of your Dropbox")
import os from dbupload import upload_file from getpass import getpass email = raw_input("Enter Dropbox email address:") password = getpass("Enter Dropbox password:"******"/path/to/your/directory" for file in os.listdir(path): if os.path.isfile(os.path.join(path, file)): print("found " + os.path.basename(file)) upload_file(os.path.join(path, file), "/", "dbupload_test.txt", email, password) print("Uploaded " + os.path.basename(file) + " to dropbox")