akshare-proxy-patch 0.2.5__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-proxy-patch
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
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
@@ -19,7 +19,7 @@ Dynamic: license-file
19
19
  Dynamic: requires-python
20
20
 
21
21
  # AkShare Proxy Patch
22
- 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免AKShare: `stock_zh_a_spot_em`、get_realtime_quotes: `get_realtime_quotes` 等东财 eastmoney 接口报错问题。
22
+ 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
23
23
 
24
24
  ## 安装
25
25
 
@@ -33,14 +33,14 @@ pip install upgrade akshare
33
33
  pip install upgrade efinance
34
34
  ```
35
35
 
36
- 2. 安装最新版本的 `akshare-proxy-patch` 或者 ``
36
+ 2. 安装最新版本的 `akshare-proxy-patch`
37
37
  ```
38
- pip install akshare-proxy-patch==0.2.5
38
+ pip install akshare-proxy-patch==0.2.6
39
39
  ```
40
40
 
41
- 最好默认用国外源,国内源不是最新的,安装不上 0.2.5 的可以安装 0.2.4
41
+ 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
42
42
 
43
- ## 使用
43
+ ## 使用方法
44
44
 
45
45
  1. `akshare` 和 `efinance` 使用方式一致,在文件顶部添加如下代码
46
46
  ```
@@ -48,8 +48,9 @@ pip install akshare-proxy-patch==0.2.5
48
48
  import akshare_proxy_patch
49
49
 
50
50
  # 参数1: AUTH_IP
51
- # 参数2: AUTH_TOKEN
52
- akshare_proxy_patch.install_patch("101.201.173.125", "")
51
+ # 参数2: AUTH_TOKEN,默认为空
52
+ # 参数3: retry 重试次数,默认30
53
+ akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
53
54
 
54
55
  # 你的正常业务代码不变
55
56
 
@@ -1,5 +1,5 @@
1
1
  # AkShare Proxy Patch
2
- 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免AKShare: `stock_zh_a_spot_em`、get_realtime_quotes: `get_realtime_quotes` 等东财 eastmoney 接口报错问题。
2
+ 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
3
3
 
4
4
  ## 安装
5
5
 
@@ -13,14 +13,14 @@ pip install upgrade akshare
13
13
  pip install upgrade efinance
14
14
  ```
15
15
 
16
- 2. 安装最新版本的 `akshare-proxy-patch` 或者 ``
16
+ 2. 安装最新版本的 `akshare-proxy-patch`
17
17
  ```
18
- pip install akshare-proxy-patch==0.2.5
18
+ pip install akshare-proxy-patch==0.2.6
19
19
  ```
20
20
 
21
- 最好默认用国外源,国内源不是最新的,安装不上 0.2.5 的可以安装 0.2.4
21
+ 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
22
22
 
23
- ## 使用
23
+ ## 使用方法
24
24
 
25
25
  1. `akshare` 和 `efinance` 使用方式一致,在文件顶部添加如下代码
26
26
  ```
@@ -28,8 +28,9 @@ pip install akshare-proxy-patch==0.2.5
28
28
  import akshare_proxy_patch
29
29
 
30
30
  # 参数1: AUTH_IP
31
- # 参数2: AUTH_TOKEN
32
- akshare_proxy_patch.install_patch("101.201.173.125", "")
31
+ # 参数2: AUTH_TOKEN,默认为空
32
+ # 参数3: retry 重试次数,默认30
33
+ akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
33
34
 
34
35
  # 你的正常业务代码不变
35
36
 
@@ -3,7 +3,7 @@ import threading
3
3
  import requests
4
4
  from requests.adapters import HTTPAdapter
5
5
 
6
- __version__ = "0.2.5"
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-proxy-patch
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
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
@@ -19,7 +19,7 @@ Dynamic: license-file
19
19
  Dynamic: requires-python
20
20
 
21
21
  # AkShare Proxy Patch
22
- 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免AKShare: `stock_zh_a_spot_em`、get_realtime_quotes: `get_realtime_quotes` 等东财 eastmoney 接口报错问题。
22
+ 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
23
23
 
24
24
  ## 安装
25
25
 
@@ -33,14 +33,14 @@ pip install upgrade akshare
33
33
  pip install upgrade efinance
34
34
  ```
35
35
 
36
- 2. 安装最新版本的 `akshare-proxy-patch` 或者 ``
36
+ 2. 安装最新版本的 `akshare-proxy-patch`
37
37
  ```
38
- pip install akshare-proxy-patch==0.2.5
38
+ pip install akshare-proxy-patch==0.2.6
39
39
  ```
40
40
 
41
- 最好默认用国外源,国内源不是最新的,安装不上 0.2.5 的可以安装 0.2.4
41
+ 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
42
42
 
43
- ## 使用
43
+ ## 使用方法
44
44
 
45
45
  1. `akshare` 和 `efinance` 使用方式一致,在文件顶部添加如下代码
46
46
  ```
@@ -48,8 +48,9 @@ pip install akshare-proxy-patch==0.2.5
48
48
  import akshare_proxy_patch
49
49
 
50
50
  # 参数1: AUTH_IP
51
- # 参数2: AUTH_TOKEN
52
- akshare_proxy_patch.install_patch("101.201.173.125", "")
51
+ # 参数2: AUTH_TOKEN,默认为空
52
+ # 参数3: retry 重试次数,默认30
53
+ akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
53
54
 
54
55
  # 你的正常业务代码不变
55
56
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "akshare-proxy-patch" # 包名,需在 PyPI 唯一
7
- version = "0.2.5"
7
+ version = "0.2.6"
8
8
  authors = [
9
9
  { name="cheapproxy", email="emezxyj1@gmail.com" },
10
10
  ]
@@ -5,7 +5,7 @@ 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.5",
8
+ version="0.2.6",
9
9
  author="cheapproxy.net",
10
10
  author_email="emezxyj1@gmail.com",
11
11
  description="AkShare 和 efinance 报错全局Hook",