Download A Giant File With Http And Upload To Ftp Server Without Storing It
I have a project which I should download some giant files using HTTP and upload them to am FTP server. The simplest way is to first download the file and then upload it to FTP; Thi
Solution 1:
Use requests
module to obtain a file-like object representing the HTTP download and use it with ftplib FTP.storbinary
:
from ftplib import FTP
import requests
url = "https://www.example.com/file.zip"
r = requests.get(url, stream=True)
ftp = FTP(host, user, passwd)
ftp.storbinary("STOR /ftp/path/file.zip", r.raw)
Post a Comment for "Download A Giant File With Http And Upload To Ftp Server Without Storing It"