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.72k stars 1.79k forks source link

macro_china_bond_public 接口异常 #5015

Closed wuyulong0931 closed 1 week ago

wuyulong0931 commented 1 week ago

报错如下: 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:117, in bond_china_close_return_map() 116 r = requests.get(url, headers=headers) --> 117 data_json = r.json() 118 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:319, in macro_china_bond_public() 312 def macro_china_bond_public() -> pd.DataFrame: 313 """ 314 中国-债券信息披露-债券发行 315 https://www.chinamoney.com.cn/chinese/xzjfx/ 316 :return: 债券发行 317 :rtype: pandas.DataFrame 318 """ --> 319 bond_china_close_return_map() 320 url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-an/bnBondEmit" 321 headers = { 322 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " 323 "Chrome/81.0.4044.138 Safari/537.36", 324 }

File c:\Users\sjyt00001\miniconda3\lib\site-packages\akshare\bond\bond_china_money.py:121, in bond_china_close_return_map() 119 session = __bond_register_service() 120 r = session.get(url, headers=headers) --> 121 data_json = r.json() 122 temp_df = pd.DataFrame(data_json["records"]) 123 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)

albertandking commented 1 week ago

报错如下: 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\simplejsoninit.py:514, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, allow_nan, **kw) 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 and not use_decimal and not allow_nan and not kw): --> 514 return _default_decoder.decode(s) 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:117, in bond_china_close_return_map() 116 r = requests.get(url, headers=headers) --> 117 data_json = r.json() 118 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\simplejsoninit.py:514, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, allow_nan, **kw) 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 and not use_decimal and not allow_nan and not kw): --> 514 return _default_decoder.decode(s) 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:319, in macro_china_bond_public() 312 def macro_china_bond_public() -> pd.DataFrame: 313 """ 314 中国-债券信息披露-债券发行 315 https://www.chinamoney.com.cn/chinese/xzjfx/ 316 :return: 债券发行 317 :rtype: pandas.DataFrame 318 """ --> 319 bond_china_close_return_map() 320 url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-an/bnBondEmit" 321 headers = { 322 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " 323 "Chrome/81.0.4044.138 Safari/537.36", 324 }

File c:\Users\sjyt00001\miniconda3\lib\site-packages\akshare\bond\bond_china_money.py:121, in bond_china_close_return_map() 119 session = __bond_register_service() 120 r = session.get(url, headers=headers) --> 121 data_json = r.json() 122 temp_df = pd.DataFrame(data_json["records"]) 123 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)

请按 issue 格式填写问题;已修改该问题,升级到 AKShare 1.14.24 使用