akshare-proxy-patch 0.2.6__tar.gz → 0.2.7__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.6
3
+ Version: 0.2.7
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`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
22
+ 针对 akshare 和 efinance 的插件补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
23
23
 
24
24
  ## 安装
25
25
 
@@ -27,18 +27,18 @@ Dynamic: requires-python
27
27
 
28
28
  ```
29
29
  # akshare 用户
30
- pip install upgrade akshare
30
+ pip install --upgrade akshare
31
31
 
32
32
  # efinance 用户
33
- pip install upgrade efinance
33
+ pip install --upgrade efinance
34
34
  ```
35
35
 
36
36
  2. 安装最新版本的 `akshare-proxy-patch`
37
37
  ```
38
- pip install akshare-proxy-patch==0.2.6
38
+ pip install akshare-proxy-patch==0.2.7
39
39
  ```
40
40
 
41
- 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
41
+ 最好默认用国外源,国内源不是最新的,可能没更新
42
42
 
43
43
  ## 使用方法
44
44
 
@@ -52,11 +52,11 @@ import akshare_proxy_patch
52
52
  # 参数3: retry 重试次数,默认30
53
53
  akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
54
54
 
55
- # 你的正常业务代码不变
55
+ # 你的正常业务代码保持不变
56
56
 
57
57
  # 假如使用akshare
58
- # import akshare as ak
59
- # df = ak.stock_zh_a_spot_em()
58
+ import akshare as ak
59
+ df = ak.stock_zh_a_spot_em()
60
60
 
61
61
  # 假如使用 efinance
62
62
  import efinance as ef
@@ -1,5 +1,5 @@
1
1
  # AkShare Proxy Patch
2
- 针对 AkShare 和 efinance 的底层补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
2
+ 针对 akshare 和 efinance 的插件补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
3
3
 
4
4
  ## 安装
5
5
 
@@ -7,18 +7,18 @@
7
7
 
8
8
  ```
9
9
  # akshare 用户
10
- pip install upgrade akshare
10
+ pip install --upgrade akshare
11
11
 
12
12
  # efinance 用户
13
- pip install upgrade efinance
13
+ pip install --upgrade efinance
14
14
  ```
15
15
 
16
16
  2. 安装最新版本的 `akshare-proxy-patch`
17
17
  ```
18
- pip install akshare-proxy-patch==0.2.6
18
+ pip install akshare-proxy-patch==0.2.7
19
19
  ```
20
20
 
21
- 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
21
+ 最好默认用国外源,国内源不是最新的,可能没更新
22
22
 
23
23
  ## 使用方法
24
24
 
@@ -32,11 +32,11 @@ import akshare_proxy_patch
32
32
  # 参数3: retry 重试次数,默认30
33
33
  akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
34
34
 
35
- # 你的正常业务代码不变
35
+ # 你的正常业务代码保持不变
36
36
 
37
37
  # 假如使用akshare
38
- # import akshare as ak
39
- # df = ak.stock_zh_a_spot_em()
38
+ import akshare as ak
39
+ df = ak.stock_zh_a_spot_em()
40
40
 
41
41
  # 假如使用 efinance
42
42
  import efinance as ef
@@ -3,7 +3,7 @@ import threading
3
3
  import requests
4
4
  from requests.adapters import HTTPAdapter
5
5
 
6
- __version__ = "0.2.6"
6
+ __version__ = "0.2.7"
7
7
  # 备份 Session 的原始 request 方法,这是所有 requests.get/post 的最终入口
8
8
  _original_request = requests.Session.request
9
9
  _auth_session = requests.Session()
@@ -93,12 +93,10 @@ def install_patch(auth_ip, auth_token, retry=30):
93
93
  if resp.ok:
94
94
  return resp
95
95
 
96
- # 如果遇到 403 等可能是代理失效
97
- if resp.status_code == 403:
98
- with _cache.lock:
99
- _cache.expire_at = 0
96
+ with _cache.lock:
97
+ _cache.expire_at = 0
98
+ time.sleep(0.1)
100
99
  except Exception:
101
- # 网络异常直接使缓存失效,强制下一个请求换 IP
102
100
  with _cache.lock:
103
101
  _cache.expire_at = 0
104
102
  time.sleep(0.1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-proxy-patch
3
- Version: 0.2.6
3
+ Version: 0.2.7
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`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
22
+ 针对 akshare 和 efinance 的插件补丁,自动为东财接口注入代理认证头,从而避免`akshare: stock_zh_a_spot_em`、`efinance: get_realtime_quotes` 等东财 eastmoney 接口报错问题。
23
23
 
24
24
  ## 安装
25
25
 
@@ -27,18 +27,18 @@ Dynamic: requires-python
27
27
 
28
28
  ```
29
29
  # akshare 用户
30
- pip install upgrade akshare
30
+ pip install --upgrade akshare
31
31
 
32
32
  # efinance 用户
33
- pip install upgrade efinance
33
+ pip install --upgrade efinance
34
34
  ```
35
35
 
36
36
  2. 安装最新版本的 `akshare-proxy-patch`
37
37
  ```
38
- pip install akshare-proxy-patch==0.2.6
38
+ pip install akshare-proxy-patch==0.2.7
39
39
  ```
40
40
 
41
- 最好默认用国外源,国内源不是最新的,版本必须 >=0.2.4
41
+ 最好默认用国外源,国内源不是最新的,可能没更新
42
42
 
43
43
  ## 使用方法
44
44
 
@@ -52,11 +52,11 @@ import akshare_proxy_patch
52
52
  # 参数3: retry 重试次数,默认30
53
53
  akshare_proxy_patch.install_patch("101.201.173.125", "", 30)
54
54
 
55
- # 你的正常业务代码不变
55
+ # 你的正常业务代码保持不变
56
56
 
57
57
  # 假如使用akshare
58
- # import akshare as ak
59
- # df = ak.stock_zh_a_spot_em()
58
+ import akshare as ak
59
+ df = ak.stock_zh_a_spot_em()
60
60
 
61
61
  # 假如使用 efinance
62
62
  import efinance as ef
@@ -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.6"
7
+ version = "0.2.7"
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.6",
8
+ version="0.2.7",
9
9
  author="cheapproxy.net",
10
10
  author_email="emezxyj1@gmail.com",
11
11
  description="AkShare 和 efinance 报错全局Hook",