为了账号安全,请及时绑定邮箱和手机立即绑定

python 爬虫怎么处理json内容

python 爬虫怎么处理json内容

千万里不及你 2018-10-04 17:19:45

2 回答

?
人到中年有点甜

TA贡献1732条经验 获得超7个赞

import requests

url = 'http://query.sse.com.cn/commonSoaQuery.do?siteId=28&sqlId=BS_GGLL&extGGLX=&stockcode=&channelId=10743%2C10744%2C10012&extGGDL=&order=createTime%7Cdesc%2Cstockcode%7Casc&isPagination=true&pageHelp.pageSize=15&pageHelp.pageNo=1&pageHelp.beginPage=1&pageHelp.cacheSize=1&pageHelp.endPage=5&_=1498029409382'

session = requests.session()

session.headers.update({

    'Referer': 'http://www.sse.com.cn/disclosure/credibility/supervision/inquiries/',

    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'

})

result = session.get(url).json()

print result


查看完整回答
反对 回复 2018-10-14
?
繁花如伊

TA贡献1934条经验 获得超9个赞

import requests


url = 'http://query.sse.com.cn/commonSoaQuery.do?siteId=28&sqlId=BS_GGLL&extGGLX=&stockcode=&channelId=10743%2C10744%2C10012&extGGDL=&order=createTime%7Cdesc%2Cstockcode%7Casc&isPagination=true&pageHelp.pageSize=15&pageHelp.pageNo=1&pageHelp.beginPage=1&pageHelp.cacheSize=1&pageHelp.endPage=5'


headers = {

    'Referer':'http://www.sse.com.cn/disclosure/credibility/supervision/inquiries/',

    'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'

}

r = requests.get(url, headers=headers)

print r.json()['result']


查看完整回答
反对 回复 2018-10-14

添加回答

回复

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信