<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                1. 支持 http/https 2. 支持HTTP 1.1的 Keep-Alive特性,能夠在同一個socket連接里使用并發的httprequest 3. 支持授權 4. 支持Cache 5. 提供所有HTTP支持的方法,不只是GET和POST,還包括DELETE,CONNECT吧 6. 自動通過”GET“方法,重定向3XX返回值 7. 支持deflate和gzip兩種資源壓縮格式 ### 使用httplib2 瀏覽網頁 ~~~ #!/usr/bin/env python #coding=utf-8 import urllib import httplib2 http = httplib2.Http() url="http://uliweb.clkg.org/login" response,content=http.request(url,'GET') print content ~~~ ### 提交數據 ~~~ #!/usr/bin/env python #coding=utf-8 import urllib import httplib2 http = httplib2.Http() url="http://uliweb.xxx.xxx.com/new_topic" body={'title':'test'} headers= {'Content-type':'application/x-www-form-urlencoded'} response,content=http.request(url,'POST',headers=headers,body=urllib.urlencode(body)) print content ~~~ 要求:網址是帶有能提交內容的網址, body是網址的源代碼帶有 input或者textarea等表單。 例如: ### 一般登錄方式 我們可以利用POST的特性來模擬登錄到網站。 ~~~ #!/usr/bin/env python #coding=utf-8 import urllib import httplib2 http = httplib2.Http() url="http://uliweb.clkg.org/login" body={'username':'python','password':'python','rememberme':"True"} headers={'Content-type':'application/x-www-form-urlencoded', "Connection": "Keep-Alive", "cache-control":"no-cache", } response,content = http.request(url,'POST',headers=headers,body=urllib.urlencode(body)) headers['Cookie']= response['set-cookie'] url='http://uliweb.clkg.org/forum' response,content=http.request(url,'GET',headers=headers) ~~~ 1. 獲取注冊頁面地址; 2. 將注冊提交的內容寫到body里面,作為'POST'的參數; 這種方式適合在非防范登錄方式可以使用。 uliweb添加了 CSRF(非法入侵,交叉站點訪問)。 因此我們需要以下代碼來訪問uliweb的登錄: ~~~ #!/usr/bin/env python #coding=utf-8 import urllib import httplib2 http = httplib2.Http() url="http://uliweb.clkg.org/login" body={'username':'python','password':'python','rememberme':"True"} headers={'Content-type':'application/x-www-form-urlencoded', "Connection": "Keep-Alive", "cache-control":"no-cache", } response,content = http.request(url,'GET') csrf_val = content.split('csrf_token" value="')[1].split('">')[0] body['csrf_token'] = csrf_val headers['Cookie']= response['set-cookie'] response,content = http.request(url,'POST',headers=headers,body=urllib.urlencode(body)) url='http://uliweb.clkg.org/forum' response,content=http.request(url,'GET',headers=headers) print content ~~~ 1. 我們先下載login頁面 2. 獲取csrf token代碼 3. 在POST的時候將csrf_token代碼發送給服務器
                  <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>

                              哎呀哎呀视频在线观看