
Download a file using ftp with python - something
Download data from ftp server with Python
Recently, I needed to download the latest version of software from a ftp server then install it into tested machine.
I think there might be someone would need to know this so today I'm gonna share with you how to download data from ftp server with Python.
The following post might be how to install the app automatically.
I.What is ftp server:
You might want to read this but basically ftp server is where you store the files
II.FTPlib in Python:
You might want to go to official doc for ftplib in here
We're gonna use ftplib to interact with ftp server
III.Real world example:
Below is a sample working ftp server
The scenario is this, we need to go to that server, find the latest version of file, and download it.
If the latest version of file is already downloaded, no need to download it again.
1.Store the downloaded version name into yaml file:
Sample configuration file where we have coccoc_dev_version
Self-made utils for working with yaml files
Override latest version of file to yaml:
2.Download the latest version of file if it's not downloaded yet
Notice we need to provide username and password along with the ftp host name like:
3.Main function to download file, and updated version name into the configurations file:
You can checkout the full source code in github in here
Hope this helps.
Peace!!!
Notes: If you feel this blog help you and want to show the appreciation, feel free to drop by :
This will help me to contributing more valued contents.
-
-