0

如何从JQuery中读取json中的内容

import json
import requests
import time

def asas(url):
    headers = {
        "Content-Type": "text/plain; charset=utf-8",
        'Referer': 'http://zjt.shandong.gov.cn/xyzj/DTFront/ZongHeSearch/Detail_Company.aspx?ProjectNum=370999201902130102&CertNO=0&searchType=2',
        "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36",
    }

    wor={
         'callback':'jQuery17108353276674591319_1560473065957',
         'methodname':'GetProjectInfo',
         'ProjectNum':'370999201902130102',
         'ProjectName':'',
         'CityCode':'',
         'ProjectType':'',
         'BuildCorp':'',
         'ConsCorp':'',
         'Constructop':'',
         'Supervision':'',
         'CurrPageIndex':1,
         'PageSize':1,
         'TopNum':1,
         '-':'1560473066046',
         }
    comments = requests.get(url,data=wor,headers=headers)
    jd = json.loads(comments.text) 

 
    print(jd)
 


if __name__ == '__main__':
    urls='http://221.214.94.41:81/InformationReleasing/Ashx/InformationReleasing.ashx?'
    url= asas(urls)  

题目来源及自己的思路

相关代码

// 请把代码文本粘贴到下方(请勿用图片代替代码)

你期待的结果是什么?实际看到的错误信息又是什么?

aopoooo 10
2019-06-14 提问
2 个回答
1

callback参数不要传

0

感谢您的回复!
我试了一下,还是报同样的错误.

import json
import requests
import time

def asas(url):

headers = {
    "Content-Type": "text/plain; charset=utf-8",
    'Referer': 'http://zjt.shandong.gov.cn/xyzj/DTFront/ZongHeSearch/Detail_Company.aspx?ProjectNum=370999201902130102&CertNO=0&searchType=2',
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36",
}

wor={
     'methodname':'GetProjectInfo',
     'ProjectNum':'370999201902130102',
     'ProjectName':'',
     'CityCode':'',
     'ProjectType':'',
     'BuildCorp':'',
     'ConsCorp':'',
     'Constructop':'',
     'Supervision':'',
     'CurrPageIndex':1,
     'PageSize':1,
     'TopNum':1,
     '-':'1560732472155',
     }
comments = requests.get(url,data=wor,headers=headers)
jd = json.loads(comments.text) 


print(jd)


   

if name == '__main__':

urls='http://221.214.94.41:81/InformationReleasing/Ashx/InformationReleasing.ashx?callback=jQuery17107411760366652407_1560732471975'
url= asas(urls)  



运行后:JSONDecodeError       Traceback (most recent call last)
Expecting value: line 1 column 1 (char 0)




撰写答案

推广链接