akshare-proxy-patch 0.2.4__tar.gz → 0.2.6__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 akshare-proxy-patch might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-proxy-patch
3
- Version: 0.2.4
4
- Summary: 针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
3
+ Version: 0.2.6
4
+ Summary: 针对 AkShare 和 efinance 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
5
5
  Home-page: https://github.com/helloyie/akshare-proxy-patch
6
6
  Author: cheapproxy.net
7
7
  Author-email: cheapproxy <emezxyj1@gmail.com>
@@ -12,7 +12,6 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.6
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: akshare
16
15
  Requires-Dist: requests
17
16
  Dynamic: author
18
17
  Dynamic: home-page
@@ -20,37 +19,48 @@ Dynamic: license-file
20
19
  Dynamic: requires-python
21
20
 
22
21
  # AkShare Proxy Patch
23
- 针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
22
+ 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
24
23
 
25
24
  ## 安装
26
25
 
27
- 1. 将官方 `akshare` 升级到最新
26
+ 1. 将官方 [akshare](https://github.com/akfamily/akshare) 或 [efinance](https://github.com/Micro-sheep/efinance) 升级到最新
28
27
 
29
28
  ```
29
+ # akshare 用户
30
30
  pip install upgrade akshare
31
+
32
+ # efinance 用户
33
+ pip install upgrade efinance
31
34
  ```
32
35
 
33
36
  2. 安装最新版本的 `akshare-proxy-patch`
34
37
  ```
35
- pip install akshare-proxy-patch==0.2.3
38
+ pip install akshare-proxy-patch==0.2.6
36
39
  ```
37
40
 
38
- 最好默认用国外源,国内源有时不是最新的
39
-
40
- ## 使用
41
+ 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
41
42
 
42
- 1. 登录 https://cheapproxy.net,获取授权码 `AUTH_IP` 和 `AUTH_TOKEN`
43
+ ## 使用方法
43
44
 
44
- 2. 在使用 akshare 文件顶部添加下面的内容
45
+ 1. `akshare` 和 `efinance` 使用方式一致,在文件顶部添加如下代码
45
46
  ```
46
47
  # 文件顶部添加
47
48
  import akshare_proxy_patch
48
49
 
49
- akshare_proxy_patch.install_patch("AUTH_IP", "AUTH_TOKEN")
50
+ # 参数1: AUTH_IP
51
+ # 参数2: AUTH_TOKEN,默认为空
52
+ # 参数3: retry 重试次数,默认30
53
+ akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
50
54
 
51
- # 你的正常业务代码......
55
+ # 你的正常业务代码不变
56
+
57
+ # 假如使用akshare
52
58
  # import akshare as ak
53
59
  # df = ak.stock_zh_a_spot_em()
60
+
61
+ # 假如使用 efinance
62
+ import efinance as ef
63
+ ef.stock.get_realtime_quotes()
54
64
  ```
55
65
 
56
66
  ## 目前Hook的接口域名清单
@@ -0,0 +1,55 @@
1
+ # AkShare Proxy Patch
2
+ 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
3
+
4
+ ## 安装
5
+
6
+ 1. 将官方 [akshare](https://github.com/akfamily/akshare) 或 [efinance](https://github.com/Micro-sheep/efinance) 升级到最新
7
+
8
+ ```
9
+ # akshare 用户
10
+ pip install upgrade akshare
11
+
12
+ # efinance 用户
13
+ pip install upgrade efinance
14
+ ```
15
+
16
+ 2. 安装最新版本的 `akshare-proxy-patch`
17
+ ```
18
+ pip install akshare-proxy-patch==0.2.6
19
+ ```
20
+
21
+ 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
22
+
23
+ ## 使用方法
24
+
25
+ 1. `akshare` 和 `efinance` 使用方式一致,在文件顶部添加如下代码
26
+ ```
27
+ # 文件顶部添加
28
+ import akshare_proxy_patch
29
+
30
+ # 参数1: AUTH_IP
31
+ # 参数2: AUTH_TOKEN,默认为空
32
+ # 参数3: retry 重试次数,默认30
33
+ akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
34
+
35
+ # 你的正常业务代码不变
36
+
37
+ # 假如使用akshare
38
+ # import akshare as ak
39
+ # df = ak.stock_zh_a_spot_em()
40
+
41
+ # 假如使用 efinance
42
+ import efinance as ef
43
+ ef.stock.get_realtime_quotes()
44
+ ```
45
+
46
+ ## 目前Hook的接口域名清单
47
+ - fund.eastmoney.com
48
+ - push2.eastmoney.com
49
+ - push2his.eastmoney.com
50
+
51
+ ## 使用问题交流群
52
+
53
+ 如遇到部分接口报错,可进群交流:
54
+
55
+ ![8jmzvNOjKWFzwNUDW0Xiytcpfr50uMr5.webp](https://cdn.nodeimage.com/i/8jmzvNOjKWFzwNUDW0Xiytcpfr50uMr5.webp)
@@ -3,7 +3,7 @@ import threading
3
3
  import requests
4
4
  from requests.adapters import HTTPAdapter
5
5
 
6
- __version__ = "0.2.4"
6
+ __version__ = "0.2.6"
7
7
  # 备份 Session 的原始 request 方法,这是所有 requests.get/post 的最终入口
8
8
  _original_request = requests.Session.request
9
9
  _auth_session = requests.Session()
@@ -49,7 +49,7 @@ def get_auth_config_with_cache(auth_url, auth_token):
49
49
  return _cache.data
50
50
 
51
51
 
52
- def install_patch(auth_ip, auth_token):
52
+ def install_patch(auth_ip, auth_token, retry=30):
53
53
  def patched_request(self, method, url, **kwargs):
54
54
  # 排除非目标域名
55
55
  is_target = any(
@@ -67,7 +67,7 @@ def install_patch(auth_ip, auth_token):
67
67
  auth_url = f"http://{auth_ip}:47001/api/akshare-auth"
68
68
 
69
69
  # 重试逻辑
70
- for _ in range(10):
70
+ for _ in range(retry):
71
71
  auth_res = get_auth_config_with_cache(auth_url, auth_token)
72
72
  if not auth_res:
73
73
  time.sleep(0.5)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-proxy-patch
3
- Version: 0.2.4
4
- Summary: 针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
3
+ Version: 0.2.6
4
+ Summary: 针对 AkShare 和 efinance 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
5
5
  Home-page: https://github.com/helloyie/akshare-proxy-patch
6
6
  Author: cheapproxy.net
7
7
  Author-email: cheapproxy <emezxyj1@gmail.com>
@@ -12,7 +12,6 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.6
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: akshare
16
15
  Requires-Dist: requests
17
16
  Dynamic: author
18
17
  Dynamic: home-page
@@ -20,37 +19,48 @@ Dynamic: license-file
20
19
  Dynamic: requires-python
21
20
 
22
21
  # AkShare Proxy Patch
23
- 针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
22
+ 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
24
23
 
25
24
  ## 安装
26
25
 
27
- 1. 将官方 `akshare` 升级到最新
26
+ 1. 将官方 [akshare](https://github.com/akfamily/akshare) 或 [efinance](https://github.com/Micro-sheep/efinance) 升级到最新
28
27
 
29
28
  ```
29
+ # akshare 用户
30
30
  pip install upgrade akshare
31
+
32
+ # efinance 用户
33
+ pip install upgrade efinance
31
34
  ```
32
35
 
33
36
  2. 安装最新版本的 `akshare-proxy-patch`
34
37
  ```
35
- pip install akshare-proxy-patch==0.2.3
38
+ pip install akshare-proxy-patch==0.2.6
36
39
  ```
37
40
 
38
- 最好默认用国外源,国内源有时不是最新的
39
-
40
- ## 使用
41
+ 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
41
42
 
42
- 1. 登录 https://cheapproxy.net,获取授权码 `AUTH_IP` 和 `AUTH_TOKEN`
43
+ ## 使用方法
43
44
 
44
- 2. 在使用 akshare 文件顶部添加下面的内容
45
+ 1. `akshare` 和 `efinance` 使用方式一致,在文件顶部添加如下代码
45
46
  ```
46
47
  # 文件顶部添加
47
48
  import akshare_proxy_patch
48
49
 
49
- akshare_proxy_patch.install_patch("AUTH_IP", "AUTH_TOKEN")
50
+ # 参数1: AUTH_IP
51
+ # 参数2: AUTH_TOKEN,默认为空
52
+ # 参数3: retry 重试次数,默认30
53
+ akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
50
54
 
51
- # 你的正常业务代码......
55
+ # 你的正常业务代码不变
56
+
57
+ # 假如使用akshare
52
58
  # import akshare as ak
53
59
  # df = ak.stock_zh_a_spot_em()
60
+
61
+ # 假如使用 efinance
62
+ import efinance as ef
63
+ ef.stock.get_realtime_quotes()
54
64
  ```
55
65
 
56
66
  ## 目前Hook的接口域名清单
@@ -4,15 +4,14 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "akshare-proxy-patch" # 包名,需在 PyPI 唯一
7
- version = "0.2.4"
7
+ version = "0.2.6"
8
8
  authors = [
9
9
  { name="cheapproxy", email="emezxyj1@gmail.com" },
10
10
  ]
11
- description = "针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。"
11
+ description = "针对 AkShare 和 efinance 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.7"
14
14
  dependencies = [
15
- "akshare",
16
15
  "requests",
17
16
  ]
18
17
  classifiers = [
@@ -5,10 +5,10 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setup(
7
7
  name="akshare-proxy-patch", # 包名,用户 pip install 时的名称
8
- version="0.2.4", # 版本号
8
+ version="0.2.6",
9
9
  author="cheapproxy.net",
10
10
  author_email="emezxyj1@gmail.com",
11
- description="AkShare 报错全局Hook",
11
+ description="AkShare 和 efinance 报错全局Hook",
12
12
  long_description=long_description,
13
13
  long_description_content_type="text/markdown",
14
14
  url="https://github.com/helloyie/akshare-proxy-patch", # 项目主页
@@ -1,44 +0,0 @@
1
- # AkShare Proxy Patch
2
- 针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
3
-
4
- ## 安装
5
-
6
- 1. 将官方 `akshare` 升级到最新
7
-
8
- ```
9
- pip install upgrade akshare
10
- ```
11
-
12
- 2. 安装最新版本的 `akshare-proxy-patch`
13
- ```
14
- pip install akshare-proxy-patch==0.2.3
15
- ```
16
-
17
- 最好默认用国外源,国内源有时不是最新的
18
-
19
- ## 使用
20
-
21
- 1. 登录 https://cheapproxy.net,获取授权码 `AUTH_IP` 和 `AUTH_TOKEN`
22
-
23
- 2. 在使用 akshare 文件顶部添加下面的内容
24
- ```
25
- # 文件顶部添加
26
- import akshare_proxy_patch
27
-
28
- akshare_proxy_patch.install_patch("AUTH_IP", "AUTH_TOKEN")
29
-
30
- # 你的正常业务代码......
31
- # import akshare as ak
32
- # df = ak.stock_zh_a_spot_em()
33
- ```
34
-
35
- ## 目前Hook的接口域名清单
36
- - fund.eastmoney.com
37
- - push2.eastmoney.com
38
- - push2his.eastmoney.com
39
-
40
- ## 使用问题交流群
41
-
42
- 如遇到部分接口报错,可进群交流:
43
-
44
- ![8jmzvNOjKWFzwNUDW0Xiytcpfr50uMr5.webp](https://cdn.nodeimage.com/i/8jmzvNOjKWFzwNUDW0Xiytcpfr50uMr5.webp)