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 TLš˜RK XLиG Xš˜RK и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
   78   79   80   81   82   83   84   85   86   87   88