waditu / tushare

TuShare is a utility for crawling historical data of China stocks
BSD 3-Clause "New" or "Revised" License
12.88k stars 4.29k forks source link

JSONDecodeError in 1.2.48 #1232

Closed li-yong closed 4 years ago

li-yong commented 4 years ago

在 anaconda 2.7 + tushare 1.2.32 正常. ryan@haha_data_source:~/tushare_ryan$ python Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 20 2016, 23:09:15) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org

import tushare as ts ts.version '1.2.32

12_25 22:04:01 http://api.tushare.pro:80 "POST / HTTP/1.1" 200 None

用annaconda 3.7 + tushare 1.2.48 出现权限错误, http 403.

import tushare as ts

pro=ts.pro_api()

pro.stock_basic(exchange='', list_status='L', fields='ts_code,symbol,name,area,industry,list_date') Traceback (most recent call last): File "", line 1, in File "/home/ryan/anaconda3/lib/python3.7/site-packages/tushare/pro/client.py", line 41, in query result = json.loads(res.text) File "/home/ryan/anaconda3/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/home/ryan/anaconda3/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/ryan/anaconda3/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

ts.version '1.2.48'

li-yong commented 4 years ago

This is caused by network, looks the network disallowed the connection to tushare server. After switching to another network, the issue no longer exist.