官方网站:PycURL Home Page
示例代码
import pycurl
import certifi
from io import BytesIO
def download(url, file_path):
buffer = BytesIO()
c = pycurl.Curl()
c.setopt(c.HTTP_VERSION, c.CURL_HTTP_VERSION_1_0)
c.setopt(c.URL, url.encode("utf-8"))
c.setopt(c.WRITEDATA, buffer)
c.setopt(c.CAINFO, certifi.where())
c.perform()
c.close()
body = buffer.getvalue()
file = open(file_path, "wb")
file.write(body)
file.close()