南宫守辰 发表于 2020-8-26 20:49:51

求助

请问这是什么错误 请大神指点{:5_92:}
而且pycharm老是显示连接不到控制台怎么办

1q23w31 发表于 2020-8-26 22:55:32

获取到的response.text不是一个json文件,如果response中有json文件,请这样调用
resp_dict = json.loads(response.json)
print(resp_dict)

南宫守辰 发表于 2020-8-27 19:03:54

1q23w31 发表于 2020-8-26 22:55
获取到的response.text不是一个json文件,如果response中有json文件,请这样调用

改了 运行出了状况

1q23w31 发表于 2020-8-27 19:10:36

南宫守辰 发表于 2020-8-27 19:03
改了 运行出了状况

发源码吧,我改

南宫守辰 发表于 2020-8-28 18:07:42

1q23w31 发表于 2020-8-27 19:10
发源码吧,我改

import requests

cookies = {
    'em_hq_fls': 'js',
    'qgqp_b_id': 'c51e053a53bbc056271a878b4d52376d',
    'ct': 'EovXYK0X9qk_Du3rAtRnsJHSOSJtJ8p42uZlH-iSjv85i6O-sJtJLeJ4drdt8tdKz9-VVPw_5HESokJCSFFalwcdl9Vj49a-PppIyQQREHlOxlJ0fGxfiFskc-5A6BXSzBBoGVa6hohj69fXtrVxbkj1vkP5uDViYev4KyGJneQ',
    'ut': 'FobyicMgeV5yNnZj1TOuTg_nlqMG7yxJ5Pw-6Uu0f3beo9nOeU_0C-6hfkf4RIh61hGGqGehk09C6xToLzQAQXvCv2TvGfu8ucYR_z1_bjaY2-IuCrvcU85tVU44ugy1fqmmh76aiUpr2irluG4jeW-PDzgWmsJOygiHpkWMqYbpobGwEWibm6MJ4NY1eQIkP4pJHJeZtiudTspZ5fSwTBnGxyaQUFzRAodKnhKVVNJYBJkXY9lBjgDdPlKlv497m_sqpxepk53NroGQ4QyDHP-ZO-F9zWB1',
    'pi': '6193305619627446^%^3bw6193305619627446^%^3b^%^e8^%^82^%^a1^%^e5^%^8f^%^8bSvsknY^%^3b3rEOq2YLMV2YHA^%^2fVU1OhkGKA7nCJd7A4ZNPUuuCX8ApIrb248FvQptugzBUoWKt6E6We9g9Ets39eGQN2kL2MC7qgIabq55wJ0RTv7Yw5VVGaUVevgiMGYtVj9zsbrvapY8tQSGVXs8Bo6utTGuepTCdVoffNA3XviCe5KU8^%^2fGxBsLa89Ke3x2Sc0oAuiGDdALY3dOWa^%^3bNUPWOMHoGFKaY9eeiCA^%^2fuPd30tKaVC1DmMo7SekS2Uq5Gfm0Q4TYF0BnOBvAV8eolh44mQH^%^2fVgGBPfrVviV7xFGzAE2hGci38lRsU9WrxSqrmcTki4K4Z1aUaxOUssnAp3Q0feUzMmf6yAFyXERcZJ^%^2fATzxbew^%^3d^%^3d',
    'uidal': '6193305619627446^%^e8^%^82^%^a1^%^e5^%^8f^%^8bSvsknY',
    'sid': '137622455',
    'vtpst': '^|',
    'waptgshowtime': '2020827',
    'HAList': 'a-sh-603222-^%^u6D4E^%^u6C11^%^u5236^%^u836F^%^2Ca-sz-300210-^%^u68EE^%^u8FDC^%^u80A1^%^u4EFD',
    'st_si': '92803866658727',
    'st_pvi': '31919449305715',
    'st_sp': '2020-08-26^%^2019^%^3A36^%^3A21',
    'st_inirUrl': 'https^%^3A^%^2F^%^2Fwww.eastmoney.com^%^2F',
    'st_sn': '1',
    'st_psi': '20200828180414481-113200301201-8605613660',
    'st_asi': 'delete',
}

headers = {
    'Connection': 'keep-alive',
    'Cache-Control': 'max-age=0',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Referer': 'http://quote.eastmoney.com/sh603222.html',
    'Accept-Language': 'zh-CN,zh;q=0.9',
}

response = requests.get('http://quote.eastmoney.com/sh603222.html', headers=headers, cookies=cookies)
resp_dict = json.loads(response.json)
print(resp_dict)

1q23w31 发表于 2020-8-28 18:40:48

南宫守辰 发表于 2020-8-28 18:07
import requests

cookies = {


爬哪些数据,发个图

南宫守辰 发表于 2020-8-28 21:05:54

1q23w31 发表于 2020-8-28 18:40
爬哪些数据,发个图

股票的

1q23w31 发表于 2020-8-28 21:06:59

南宫守辰 发表于 2020-8-28 21:05
股票的

我知道是股票 但具体你要哪个股票,发个图标注一下

南宫守辰 发表于 2020-8-28 21:15:18

1q23w31 发表于 2020-8-28 21:06
我知道是股票 但具体你要哪个股票,发个图标注一下

济民制药
页: [1]
查看完整版本: 求助