【Python3】HTTP GET (requests)

pip install requests
import requests
_url = ‘http://xx.com/a.mp4’
 r = requests.get(_url, auth=(_user,_pass), stream=True)
try:
if r.status_code == 200:
f = open(“a.mp4”, ‘wb’)
f.write(r.content)
f.close()
else:
print(“[dl_mov] status_code=” +  r.status_code)
except:
print(“[dl_mov] exception”)

Leave a Comment.