<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] ## 1.安裝requests ``` pip install requests ``` ## 2.使用requests ### 2.1基本使用 ~~~ import requests response = requests.get('http://www.baidu.com/') print(type(response)) print(response.status_code) print(type(response.text)) print(response.text[:100]) print(response.cookies) ~~~ ``` // 輸出: <class 'requests.models.Response'> 200 <class 'str'> <!DOCTYPE html> <!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charse <RequestsCookieJar[<Cookie BDORZ=27315 for .baidu.com/>]> ``` ~~~ // 中文亂碼 import requests r = requests.get('http://www.baidu.com') // 手動設置編碼格式,處理中文亂碼 r.encoding = 'utf8' print(r.text) // r.content拿到相應的的bytes數據,再解碼,默認utf-8;效果一樣。 print(r.content.decode()) ~~~ * response.text * 類型:str * 解碼類型: requests模塊自動根據HTTP 頭部對響應的編碼作出有根據的推測,推測的文本編碼 * response.content * 類型:bytes * 解碼類型: 沒有指定 ### 2.2攜帶請求頭發送請求 `requests.get(url, headers=headers)` ~~~ import requests url = 'http://www.baidu.com' headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'} response = requests.get(url, headers=headers) ~~~ ### 2.3發送帶參數的請求
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看