Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AKShare 接口问题报告 - index_detail_hist_cni #4826

Closed
funggtopp opened this issue May 5, 2024 · 2 comments
Closed

AKShare 接口问题报告 - index_detail_hist_cni #4826

funggtopp opened this issue May 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@funggtopp
Copy link

遇到任何问题,请先确认您的 AKShare 版本是最新的

pip install akshare --upgrade  # Python 版本需要大于等于 3.8

描述遇到的问题

  1. 操作系统版本:ubuntu
  2. Python 版本:3.11.6
  3. AKShare 版本:1.13.62
  4. 接口的名称和代码:index_detail_hist_cni
    当使用:ak.index_detail_hist_cni(symbol = '399101',date = '202404'),获取399101指数的04月样本数据时,报错。
  5. 接口报错的截图或代码:
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
File /opt/conda/lib/python3.11/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 /opt/conda/lib/python3.11/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 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 /opt/conda/lib/python3.11/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 /opt/conda/lib/python3.11/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[23], line 2
      1 import akshare as ak
----> 2 ak.index_detail_hist_cni(symbol = '399101',date = '202404')
      3 #ak.index_detail_hist_cni(symbol='399005', date='202201')

File /opt/conda/lib/python3.11/site-packages/akshare/index/index_cni.py:197, in index_detail_hist_cni(symbol, date)
    190 params = {
    191     'indexcode': symbol,
    192     'dateStr': '-'.join([date[:4], date[4:]]),
    193     'pageNum': '1',
    194     'rows': '50000',
    195 }
    196 r = requests.get(url, params=params)
--> 197 data_json = r.json()
    198 temp_df = pd.DataFrame(data_json['data']['rows'])
    199 temp_df.columns = [
    200     '-',
    201     '-',
   (...)
    210     '-',
    211 ]

File /opt/conda/lib/python3.11/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)
  1. 期望获得的正确结果:请修复接口,谢谢。
@funggtopp funggtopp added the bug Something isn't working label May 5, 2024
@funggtopp
Copy link
Author

funggtopp commented May 6, 2024

今天上午使用:ak.index_detail_hist_cni(symbol = '399101',date = '202404'),已经可以读取数据,不知何故。
今天下午又出错了。

@albertandking
Copy link
Collaborator

4. 399101

控制访问的频率

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants