爬虫 Content-Type: text/x-gwt-rpc; charset=UTF-8

Content-Type: text/x-gwt-rpc; charset=UTF-8

下载某个统计局网站,它的 Content-Type: text/x-gwt-rpc; charset=UTF-8

请求方式是 post 请求 

 

 

 

一言不合就上代码  

   url = 'http://data.ahtjj.gov.cn/bi/gwt/zbquery/zbquery'
     headers = {

        # "Host":"data.ahtjj.gov.cn",
        # "Connection":"keep-alive",
        # "Content-Length":"229",
        # "X-GWT-Module-Base":"http://data.ahtjj.gov.cn/bi/gwt/zbquery/",
        "X-GWT-Permutation":"5E9EB141DCF5CC57E7A3405E21549935",
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36",
        "Content-Type":"text/x-gwt-rpc; charset=UTF-8",
        # "Accept":"*/*",
        # "Origin":"http://data.ahtjj.gov.cn",
        # "Referer":"http://data.ahtjj.gov.cn/bi/zbquery/querymodel/querymodel.jsp?op=0&title=&id=Guid&onlyShowResult=false&schemeGuid=000001504639C3767B183BA575010B5F&function=1&windowId=015047581BC92300BC917A48BDF3322E_w129",
        # "Accept-Encoding":"gzip, deflate",
        # "Accept-Language":"zh-CN,zh;q=0.9",
        "Cookie":"JSESSIONID=B69622EB88A9A3E861C9BF5AC6485B12; clientlanguage=zh_CN; JSESSIONID=0794B111C9E5CBBD6B204A87FCF4B216",

    }
    data = '7|0|7|http://data.ahtjj.gov.cn/bi/gwt/zbquery/|6743B66F1ECCF1017396C8890D6319A5|com.jiuqi.bi.client.zbquery.querymodel.ZBQueryService|getChildren|java.lang.String/2004016611|com.jiuqi.bi.client.zbquery.common.enums.ImgType/3271576811|000001504639C3767B183BA575010B5F|1|2|3|4|2|5|6|7|6|3|'
    try:
        result = session.post(url=url,data=data,headers=headers).content
    except:
        result = session.post(url=url,data=data, headers=headers).content

  

 

posted @ 2020-10-11 16:38  淋哥  阅读(639)  评论(0编辑  收藏  举报