#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 5
# This program is optimized for Python 2.7.
# It may run on any other version with/without modifications.
FTP_SERVER_URL = 'ftp.kernel.org'
import ftplib
def test_ftp_connection(path, username, email):
	#Open ftp connection
	ftp = ftplib.FTP(path, username, email)
	#List the files in the /pub directory
	ftp.cwd("/PyBasic")
	print ("File list at %s:" %path)
	files = ftp.dir()
	print files
	ftp.quit()
if __name__ == '__main__':
	test_ftp_connection(path=FTP_SERVER_URL, username='anonymous',
	email='nobody@nourl.com',
	)

96aad173297982f8d3665aafcd0f434959626bb8
#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 5
# This program is optimized for Python 2.7.
# It may run on any other version with/without modifications.
FTP_SERVER_URL = 'ftp.kernel.org'
import ftplib
def test_ftp_connection(path, username, email):
	#Open ftp connection
	ftp = ftplib.FTP(path, username, email)
	#List the files in the /pub directory
	ftp.cwd("/PyBasic")
	print ("File list at %s:" %path)
	files = ftp.dir()
	print files
	ftp.quit()
if __name__ == '__main__':
	test_ftp_connection(path=FTP_SERVER_URL, username='anonymous',
	email='nobody@nourl.com',
	)
