agushuju 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of agushuju might be problematic. Click here for more details.

agushuju-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 安徽爱股科技有限公司
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: agushuju
3
+ Version: 0.1.1
4
+ Summary: 爱股数据,A股数据
5
+ Author-email: 安徽爱股科技有限公司 <jinguxun@qq.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/agukeji/agushuju
8
+ Keywords: agushuju,爱股数据,A股数据,agudata,api,sdk,token
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests>=2.25.0
16
+ Requires-Dist: pandas>=1.1.0
17
+ Dynamic: license-file
18
+
19
+ # agushuju
20
+ 爱股数据,A股数据
21
+ 官网:https://www.agushuju.com/
@@ -0,0 +1,3 @@
1
+ # agushuju
2
+ 爱股数据,A股数据
3
+ 官网:https://www.agushuju.com/
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agushuju"
7
+ version = "0.1.1"
8
+ description = "爱股数据,A股数据"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "安徽爱股科技有限公司", email = "jinguxun@qq.com" },
12
+ ]
13
+ license = { text = "MIT" }
14
+ keywords = ["agushuju","爱股数据","A股数据","agudata", "api", "sdk", "token"]
15
+ requires-python = ">=3.7"
16
+ dependencies = [
17
+ "requests>=2.25.0",
18
+ "pandas>=1.1.0",
19
+ ]
20
+ classifiers = [
21
+ "Programming Language :: Python :: 3",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/agukeji/agushuju"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from .client import api
2
+
3
+ __all__ = ["api"]
4
+
@@ -0,0 +1,57 @@
1
+ import os
2
+ import requests
3
+ import pandas as pd
4
+ from typing import Any, Dict, List, Optional
5
+
6
+
7
+ DEFAULT_BASE_URL = os.getenv("AGU_BASE_URL", "https://www.agushuju.com/api").rstrip("/")
8
+
9
+
10
+ class _AguProClient:
11
+ def __init__(self, token: Optional[str] = None, base_url: Optional[str] = None):
12
+ self.token = token or os.getenv("AGU_TOKEN") or ""
13
+ self.base_url = (base_url or DEFAULT_BASE_URL).rstrip("/")
14
+
15
+ def _call_endpoint(self, endpoint: str, request: Optional[Dict[str, Any]] = None, response: Optional[List[str]] = None) -> pd.DataFrame:
16
+ query: Dict[str, Any] = {}
17
+ if request is not None:
18
+ query.update({k: v for k, v in request.items() if v is not None})
19
+
20
+ fields_list: Optional[List[str]] = response
21
+ if fields_list:
22
+ query["fields"] = ",".join(fields_list)
23
+
24
+ url = f"{self.base_url}/{endpoint}"
25
+ headers = {}
26
+ if self.token:
27
+ headers["Authorization"] = f"Bearer {self.token}"
28
+
29
+ resp = requests.get(url, params=query, headers=headers, timeout=30)
30
+ resp.raise_for_status()
31
+ payload = resp.json()
32
+ if not isinstance(payload, dict) or payload.get("code") != 0:
33
+ raise RuntimeError(f"API error: {payload}")
34
+
35
+ data = payload.get("data") or []
36
+ df = pd.DataFrame(data)
37
+
38
+ if fields_list:
39
+ existing_cols = [c for c in fields_list if c in df.columns]
40
+ if existing_cols:
41
+ df = df.loc[:, existing_cols]
42
+
43
+ return df
44
+
45
+ def __getattr__(self, name: str):
46
+ def _endpoint_method(*, request: Optional[Dict[str, Any]] = None, response: Optional[List[str]] = None) -> pd.DataFrame:
47
+ return self._call_endpoint(name, request=request, response=response)
48
+ return _endpoint_method
49
+
50
+ def stock_basic(self, request: Optional[Dict[str, Any]] = None, response: Optional[List[str]] = None) -> pd.DataFrame:
51
+ return self._call_endpoint("stock_basic", request=request, response=response)
52
+
53
+
54
+ def api(token: Optional[str] = None, base_url: Optional[str] = None) -> _AguProClient:
55
+ return _AguProClient(token=token, base_url=base_url)
56
+
57
+
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: agushuju
3
+ Version: 0.1.1
4
+ Summary: 爱股数据,A股数据
5
+ Author-email: 安徽爱股科技有限公司 <jinguxun@qq.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/agukeji/agushuju
8
+ Keywords: agushuju,爱股数据,A股数据,agudata,api,sdk,token
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests>=2.25.0
16
+ Requires-Dist: pandas>=1.1.0
17
+ Dynamic: license-file
18
+
19
+ # agushuju
20
+ 爱股数据,A股数据
21
+ 官网:https://www.agushuju.com/
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/agushuju/__init__.py
5
+ src/agushuju/client.py
6
+ src/agushuju.egg-info/PKG-INFO
7
+ src/agushuju.egg-info/SOURCES.txt
8
+ src/agushuju.egg-info/dependency_links.txt
9
+ src/agushuju.egg-info/requires.txt
10
+ src/agushuju.egg-info/top_level.txt
11
+ src/aigushuju/__init__.py
@@ -0,0 +1,2 @@
1
+ requests>=2.25.0
2
+ pandas>=1.1.0
@@ -0,0 +1,2 @@
1
+ agushuju
2
+ aigushuju
@@ -0,0 +1,5 @@
1
+ from agushuju import api # 提供 aigushuju.api 的同名入口
2
+
3
+ __all__ = ["api"]
4
+
5
+