Page 83 - Python Cơ Bản
P. 83
'ɹ XLВ KЮM XLɱQ XLEQ WР files чВ YTPSEH JMPI OɯQ XLIS
VIUYIWX :ɴ Hд
import requests
url = 'http://httpbin.org/post'
files = {'file': open('report.xls', 'rb')}
r = requests.post(url, files=files)
6IWTSRWI
7EY OLM KМM GɨG TLRK XLиG XRK иRK чВ VIUYIWX FϰR WЌ
Gɹ чРM XвRK XLYШG GPEWW Response ɇРM XвRK Rɧ] Gɹ QШX
WР XLɺRK XMR RL WEY
status_code ,884 7XEXYW WIVZIV XVϲ ZА
headers 'ɨG XLɺRK XMR LIEHIV Qɧ WIVZIV XVϲ ZА HЪM
HϰRK (MGXMSREV]
cookies 2ЎY WIVZIV Gɹ XVϲ ZА GSSOMI XLɳ Gɹ XLВ Wм
HдRK XLYШG XɴRL Rɧ] чВ Pϴ] GɨG GSSOMI
text 8Vϲ ZА RШM HYRK VIWTSRWI