Created
August 16, 2014 09:17
-
-
Save jamornsriwasansak/4737e3df19f59b3ae447 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib2 | |
import time | |
from ftplib import FTP | |
user = 'something' | |
host = 'www.something.com' | |
passwd = 'asdfjkl;asdfjkl;' | |
port = 2121 | |
destination = '/domains/something.com/public_html/site' | |
session = FTP() | |
rate = 60 | |
count = 1 | |
while(1): | |
print '[Round : %d]' % (count) | |
count = count + 1 | |
"""Making session and access destination""" | |
print 'Session is connecting with %s...' % (host) | |
session.connect(host, port) | |
session.login(user, passwd) | |
print session.getwelcome() | |
session.cwd(destination) | |
print '' | |
"""Readfile and upload online""" | |
print 'Reading file and uploading...' | |
page = open('rank.xls','rb') | |
session.storbinary('STOR rank.xls', page) | |
session.close() | |
page.close() | |
print 'Uploaded' | |
print '' | |
print 'Sleeping for %d seconds...' % (rate) | |
print '\n' | |
time.sleep(rate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment