Skip to content

Commit

Permalink
Merge pull request #148 from akfamily/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
albertandking authored Jan 12, 2024
2 parents 0799482 + 2a14105 commit 9a7685e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pip install aktools --upgrade -i https://pypi.org/simple # AKTools's version sh

## AKShare

[Please visit AKShare's Documentation](https://akshare.xyz/)
[Please visit AKShare's Documentation](https://akshare.akfamily.xyz/)

## FastAPI

Expand Down
3 changes: 2 additions & 1 deletion aktools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@
0.0.81: add: add support for Python 3.11
0.0.82: fix: fix connection.py
0.0.83: fix: fix Dockerfile
0.0.84: fix: fix homepage url
"""

__title__ = "AKTools"
__version__ = "0.0.83"
__version__ = "0.0.84"
__author__ = "AKFamily"
36 changes: 18 additions & 18 deletions aktools/core/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2022/2/22 16:05
Date: 2024/1/12 22:05
Desc: HTTP 模式主文件
"""
import json
Expand All @@ -22,9 +22,9 @@

@app_core.get("/private/{item_id}", description="私人接口", summary="该接口主要提供私密访问来获取数据")
def root(
request: Request,
item_id: str,
current_user: User = Depends(get_current_active_user),
request: Request,
item_id: str,
current_user: User = Depends(get_current_active_user),
):
"""
接收请求参数及接口名称并返回 JSON 数据
Expand All @@ -45,7 +45,7 @@ def root(
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={
"error": "未找到该接口,请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://www.akshare.xyz"
"error": "未找到该接口,请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://akshare.akfamily.xyz"
},
)
eval_str = decode_params.replace("&", '", ').replace("=", '="') + '"'
Expand All @@ -55,14 +55,14 @@ def root(
if received_df is None:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={"error": "该接口返回数据为空,请确认参数是否正确:https://www.akshare.xyz"},
content={"error": "该接口返回数据为空,请确认参数是否正确:https://akshare.akfamily.xyz"},
)
temp_df = received_df.to_json(orient="records", date_format="iso")
except KeyError as e:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://www.akshare.xyz"
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://akshare.akfamily.xyz"
},
)
return JSONResponse(status_code=status.HTTP_200_OK, content=json.loads(temp_df))
Expand All @@ -72,14 +72,14 @@ def root(
if received_df is None:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={"error": "该接口返回数据为空,请确认参数是否正确:https://www.akshare.xyz"},
content={"error": "该接口返回数据为空,请确认参数是否正确:https://akshare.akfamily.xyz"},
)
temp_df = received_df.to_json(orient="records", date_format="iso")
except KeyError as e:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://www.akshare.xyz"
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://akshare.akfamily.xyz"
},
)
return JSONResponse(status_code=status.HTTP_200_OK, content=json.loads(temp_df))
Expand All @@ -104,15 +104,15 @@ def root(request: Request, item_id: str):
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={
"error": "未找到该接口,请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://www.akshare.xyz"
"error": "未找到该接口,请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://akshare.akfamily.xyz"
},
)
if "cookie" in decode_params:
eval_str = (
decode_params.split("=", maxsplit=1)[0]
+ "='"
+ decode_params.split("=", maxsplit=1)[1]
+ "'"
decode_params.split("=", maxsplit=1)[0]
+ "='"
+ decode_params.split("=", maxsplit=1)[1]
+ "'"
)
eval_str = eval_str.replace("+", " ")
else:
Expand All @@ -124,14 +124,14 @@ def root(request: Request, item_id: str):
if received_df is None:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={"error": "该接口返回数据为空,请确认参数是否正确:https://www.akshare.xyz"},
content={"error": "该接口返回数据为空,请确认参数是否正确:https://akshare.akfamily.xyz"},
)
temp_df = received_df.to_json(orient="records", date_format="iso")
except KeyError as e:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://www.akshare.xyz"
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://akshare.akfamily.xyz"
},
)
return JSONResponse(status_code=status.HTTP_200_OK, content=json.loads(temp_df))
Expand All @@ -141,14 +141,14 @@ def root(request: Request, item_id: str):
if received_df is None:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={"error": "该接口返回数据为空,请确认参数是否正确:https://www.akshare.xyz"},
content={"error": "该接口返回数据为空,请确认参数是否正确:https://akshare.akfamily.xyz"},
)
temp_df = received_df.to_json(orient="records", date_format="iso")
except KeyError as e:
return JSONResponse(
status_code=status.HTTP_404_NOT_FOUND,
content={
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://www.akshare.xyz"
"error": f"请输入正确的参数错误 {e},请升级 AKShare 到最新版本并在文档中确认该接口的使用方式:https://akshare.akfamily.xyz"
},
)
return JSONResponse(status_code=status.HTTP_200_OK, content=json.loads(temp_df))
Expand Down
4 changes: 2 additions & 2 deletions docs/aktools.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## [AKShare](https://github.com/akfamily/akshare) 的介绍

[AKShare](https://github.com/akfamily/akshare) 是目前在开源财经数据接口库里面使用较广的 Python 库,目前已经累计下载量达到 4,000,000 + 次,从
发布至今一直由广大数据科学爱好者积极维护中,其提供的内容详实且丰富的 [AKShare 文档](https://www.akshare.xyz/) 大大提高了数据查找和使用的效率。
发布至今一直由广大数据科学爱好者积极维护中,其提供的内容详实且丰富的 [AKShare 文档](https://akshare.akfamily.xyz/) 大大提高了数据查找和使用的效率。

## [FastAPI](https://github.com/tiangolo/fastapi) 的介绍

Expand All @@ -21,7 +21,7 @@
### 安装要求

由于 AKTools 是基于 [AKShare](https://github.com/akfamily/akshare)[FastAPI](https://github.com/tiangolo/fastapi) 的,所以 [AKTools](https://github.com/akfamily/aktools)
要求您的 Python 版本高于 Python 3.7(64 位) 且您的操作系统必须是 64 位的操作系统,详细要求以 [AKShare 安装指导](https://www.akshare.xyz/installation.html) 的安装要求为准。
要求您的 Python 版本高于 Python 3.7(64 位) 且您的操作系统必须是 64 位的操作系统,详细要求以 [AKShare 安装指导](https://akshare.akfamily.xyz/installation.html) 的安装要求为准。

### 一键安装

Expand Down
2 changes: 2 additions & 0 deletions docs/aktools_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

## 开发进度

0.0.84: fix: fix homepage url

0.0.83: fix: fix Dockerfile

0.0.82: fix: fix connection.py
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Successfully upgraded aktools

## AKShare

[Please visit AKShare's Documentation](https://akshare.xyz/)
[Please visit AKShare's Documentation](https://akshare.akfamily.xyz/)

## FastAPI

Expand Down

0 comments on commit 9a7685e

Please sign in to comment.