January 2019
Beginner to intermediate
776 pages
19h 58m
English
We can use the ftplib library to fetch files from our selected FTP site. A detailed documentation of this library can be found at https://docs.python.org/3/library/ftplib.html for Python 3 and at http://docs.python.org/2/library/ftplib.html for Python 2.
ftplib is a built-in Python module, and you do not need to install it separately. Let us see how we can fetch some files with ftplib.
Listing 5.1 gives a simple FTP connection test as follows:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 5 # This program is optimized for Python 2.7.12 and Python 3.5.2. # It may run on any other version with/without modifications. FTP_SERVER_URL = 'ftp.ed.ac.uk' import ftplib from ftplib import FTP ...
Read now
Unlock full access