akfamily / akshare

AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
https://akshare.akfamily.xyz
MIT License
8.8k stars 1.81k forks source link

macro_china_bond_public接口异常 #4954

Closed wuyulong0931 closed 1 month ago

wuyulong0931 commented 1 month ago

macro_china_bond_public接口异常,报错如下: JSONDecodeError Traceback (most recent call last) File c:\Users\sjyt00001\miniconda3\lib\site-packages\requests\models.py:971, in Response.json(self, kwargs) 970 try: --> 971 return complexjson.loads(self.text, kwargs) 972 except JSONDecodeError as e: 973 # Catch JSON-related errors and raise as requests.JSONDecodeError 974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File c:\Users\sjyt00001\miniconda3\lib\site-packages\simplejson__init.py:514, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, allow_nan, **kw) [510](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init.py:510) if (cls is None and encoding is None and object_hook is None and 511 parse_int is None and parse_float is None and 512 parse_constant is None and object_pairs_hook is None [513](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init.py:513) and not use_decimal and not allow_nan and not kw): --> [514](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init.py:514) return _default_decoder.decode(s) [515](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init__.py:515) if cls is None:

File c:\Users\sjyt00001\miniconda3\lib\site-packages\simplejson\decoder.py:386, in JSONDecoder.decode(self, s, _w, _PY3) 385 s = str(s, self.encoding) --> 386 obj, end = self.raw_decode(s) 387 end = _w(s, end).end()

File c:\Users\sjyt00001\miniconda3\lib\site-packages\simplejson\decoder.py:416, in JSONDecoder.raw_decode(self, s, idx, _w, _PY3) 415 idx += 3 --> 416 return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError Traceback (most recent call last) File c:\Users\sjyt00001\miniconda3\lib\site-packages\akshare\bond\bond_china_money.py:111, in bond_china_close_return_map() 110 r = requests.get(url, headers=headers) --> 111 data_json = r.json() 112 except: # noqa: E722

File c:\Users\sjyt00001\miniconda3\lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs) 972 except JSONDecodeError as e: 973 # Catch JSON-related errors and raise as requests.JSONDecodeError 974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError --> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError Traceback (most recent call last) File c:\Users\sjyt00001\miniconda3\lib\site-packages\requests\models.py:971, in Response.json(self, kwargs) 970 try: --> 971 return complexjson.loads(self.text, kwargs) 972 except JSONDecodeError as e: 973 # Catch JSON-related errors and raise as requests.JSONDecodeError 974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File c:\Users\sjyt00001\miniconda3\lib\site-packages\simplejson__init.py:514, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, allow_nan, **kw) [510](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init.py:510) if (cls is None and encoding is None and object_hook is None and 511 parse_int is None and parse_float is None and 512 parse_constant is None and object_pairs_hook is None [513](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init.py:513) and not use_decimal and not allow_nan and not kw): --> [514](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init.py:514) return _default_decoder.decode(s) [515](file:///C:/Users/sjyt00001/miniconda3/lib/site-packages/simplejson/init__.py:515) if cls is None:

File c:\Users\sjyt00001\miniconda3\lib\site-packages\simplejson\decoder.py:386, in JSONDecoder.decode(self, s, _w, _PY3) 385 s = str(s, self.encoding) --> 386 obj, end = self.raw_decode(s) 387 end = _w(s, end).end()

File c:\Users\sjyt00001\miniconda3\lib\site-packages\simplejson\decoder.py:416, in JSONDecoder.raw_decode(self, s, idx, _w, _PY3) 415 idx += 3 --> 416 return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError Traceback (most recent call last) Cell In[51], line 4 1 import akshare as ak 3 # 新债发行 ----> 4 macro_china_bond_public_df = ak.macro_china_bond_public() 5 macro_china_bond_public_df

File c:\Users\sjyt00001\miniconda3\lib\site-packages\akshare\bond\bond_china_money.py:312, in macro_china_bond_public() 305 def macro_china_bond_public() -> pd.DataFrame: 306 """ 307 中国-债券信息披露-债券发行 308 https://www.chinamoney.com.cn/chinese/xzjfx/ 309 :return: 债券发行 310 :rtype: pandas.DataFrame 311 """ --> 312 bond_china_close_return_map() 313 url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-an/bnBondEmit" 314 headers = { 315 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " 316 "Chrome/81.0.4044.138 Safari/537.36", 317 }

File c:\Users\sjyt00001\miniconda3\lib\site-packages\akshare\bond\bond_china_money.py:115, in bond_china_close_return_map() 113 session = __bond_register_service() 114 r = session.get(url, headers=headers) --> 115 data_json = r.json() 116 temp_df = pd.DataFrame(data_json["records"]) 117 return temp_df

File c:\Users\sjyt00001\miniconda3\lib\site-packages\requests\models.py:975, in Response.json(self, kwargs) 971 return complexjson.loads(self.text, kwargs) 972 except JSONDecodeError as e: 973 # Catch JSON-related errors and raise as requests.JSONDecodeError 974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError --> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

wuyulong0931 commented 1 month ago

跟4953报错重复了