Skip to content

Commit

Permalink
urllib test added
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Samoilov committed Apr 12, 2011
1 parent f1f705d commit c8e2755
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/dl_test_urllib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import M2Crypto
import sys
sys.path.append('../lib/python/')
import config.download
import urllib

myFtp = M2Crypto.ftpslib.FTP_TLS()
myFtp.connect(config.download.ftp_host, config.download.ftp_port)
myFtp.auth_tls()
myFtp.set_pasv(1)
response = myFtp.login(config.download.ftp_username, config.download.ftp_password)
print "Login Response: %s" % response

del(myFtp)

myFtp = M2Crypto.ftpslib.FTP_TLS()
myFtp.connect(config.download.ftp_host, config.download.ftp_port)
myFtp.auth_tls()
myFtp.set_pasv(1)
response = myFtp.login(config.download.ftp_username, config.download.ftp_password)
print "Login Response: %s" % response


params = urllib.urlencode({'username':config.download.api_username,'pw':config.download.api_password,'guid':'ftpTest4BitMock'})
response = urllib.urlopen("http://arecibo.tc.cornell.edu/palfadataapi/dataflow.asmx/Location?%s" % params )
print response.read()


del(myFtp)

myFtp = M2Crypto.ftpslib.FTP_TLS()
myFtp.connect(config.download.ftp_host, config.download.ftp_port)
myFtp.auth_tls()
myFtp.set_pasv(1)
response = myFtp.login(config.download.ftp_username, config.download.ftp_password)
print "Login Response: %s" % response

0 comments on commit c8e2755

Please sign in to comment.