Friday, September 22, 2017
code sync files using FTP
code sync files using FTP
My webhost doesnt support rsync, only FTP. For grins I wrote a script to scan through interesting local files and push them up to my webhost. Alas the progress wasnt as trivial as Id hoped, so I abandoned the effort and used lftp the "mirror" command.
The code shows a number of best practices:
- dont store passwords/keys, pass them in via environment variables
- make an iterator of files, add to it using chain()
- Python3 subprocess.check_output() is a little odd
- logging, like voting, should be done early and often
- code ensures FTP connection always closed cleanly
https://github.com/shavenwarthog/johntellsall/blob/master/class/django-queryset/ftpsync.py
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment