akshare-proxy-patch 0.1.2__tar.gz → 0.1.4__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.
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/PKG-INFO +3 -3
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/README.md +2 -2
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch/__init__.py +9 -7
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/PKG-INFO +3 -3
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/pyproject.toml +1 -1
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/setup.py +1 -1
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/LICENSE +0 -0
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/SOURCES.txt +0 -0
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/dependency_links.txt +0 -0
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/requires.txt +0 -0
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/top_level.txt +0 -0
- {akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: akshare-proxy-patch
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: 针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
|
|
5
5
|
Home-page: https://github.com/helloyie/akshare-proxy-patch
|
|
6
6
|
Author: cheapproxy.net
|
|
@@ -30,7 +30,7 @@ pip install --upgrade akshare-proxy-patch
|
|
|
30
30
|
|
|
31
31
|
## 使用
|
|
32
32
|
|
|
33
|
-
1. 访问 https://cheapproxy.net
|
|
33
|
+
1. 访问 https://cheapproxy.net 联系客服(备注: token),获取授权码 `AUTH_IP` 和 `AUTH_TOKEN`
|
|
34
34
|
|
|
35
35
|
2. 将 akshare 升级到最新
|
|
36
36
|
|
|
@@ -42,7 +42,7 @@ pip install --upgrade akshare
|
|
|
42
42
|
```
|
|
43
43
|
import akshare_proxy_patch
|
|
44
44
|
|
|
45
|
-
akshare_proxy_patch.install_patch("AUTH_TOKEN")
|
|
45
|
+
akshare_proxy_patch.install_patch("AUTH_IP", "AUTH_TOKEN")
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
# import akshare as ak
|
|
@@ -9,7 +9,7 @@ pip install --upgrade akshare-proxy-patch
|
|
|
9
9
|
|
|
10
10
|
## 使用
|
|
11
11
|
|
|
12
|
-
1. 访问 https://cheapproxy.net
|
|
12
|
+
1. 访问 https://cheapproxy.net 联系客服(备注: token),获取授权码 `AUTH_IP` 和 `AUTH_TOKEN`
|
|
13
13
|
|
|
14
14
|
2. 将 akshare 升级到最新
|
|
15
15
|
|
|
@@ -21,7 +21,7 @@ pip install --upgrade akshare
|
|
|
21
21
|
```
|
|
22
22
|
import akshare_proxy_patch
|
|
23
23
|
|
|
24
|
-
akshare_proxy_patch.install_patch("AUTH_TOKEN")
|
|
24
|
+
akshare_proxy_patch.install_patch("AUTH_IP", "AUTH_TOKEN")
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
# import akshare as ak
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import requests
|
|
2
1
|
import time
|
|
2
|
+
import requests
|
|
3
3
|
from requests.adapters import HTTPAdapter
|
|
4
4
|
|
|
5
5
|
original_send = HTTPAdapter.send
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def install_patch(auth_token):
|
|
8
|
+
def install_patch(auth_ip, auth_token):
|
|
9
9
|
def patched_send(self, request, **kwargs):
|
|
10
|
+
auth_url = f"http://{auth_ip}:47001/api/akshare-auth"
|
|
10
11
|
url = request.url
|
|
11
|
-
|
|
12
|
-
return original_send(self, request, **kwargs)
|
|
12
|
+
is_hook = ("push2.eastmoney.com" in url) or ("push2his.eastmoney.com" in url)
|
|
13
13
|
for i in range(60):
|
|
14
14
|
try:
|
|
15
|
+
if not is_hook:
|
|
16
|
+
return original_send(self, request, **kwargs)
|
|
15
17
|
with requests.Session() as s:
|
|
16
18
|
HTTPAdapter.send = original_send
|
|
17
|
-
auth_url = "http://akshare.cheapproxy.net/api/akshare-auth"
|
|
18
19
|
auth_res = s.get(
|
|
19
20
|
auth_url, params={"token": auth_token}, timeout=5
|
|
20
21
|
).json()
|
|
@@ -28,10 +29,11 @@ def install_patch(auth_token):
|
|
|
28
29
|
request.headers["Cookie"] = cookie_str
|
|
29
30
|
proxy = auth_res["proxy"]
|
|
30
31
|
kwargs["proxies"] = {"http": proxy, "https": proxy}
|
|
31
|
-
kwargs["timeout"] =
|
|
32
|
+
kwargs["timeout"] = 8
|
|
32
33
|
return original_send(self, request, **kwargs)
|
|
33
34
|
except Exception as e:
|
|
34
|
-
|
|
35
|
+
if not is_hook:
|
|
36
|
+
time.sleep(0.5)
|
|
35
37
|
HTTPAdapter.send = patched_send
|
|
36
38
|
|
|
37
39
|
return original_send(self, request, **kwargs)
|
{akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: akshare-proxy-patch
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: 针对 AkShare 的底层补丁,自动为东财等接口注入代理认证头,从而避免 `stock_zh_a_spot_em` 等方法报错。
|
|
5
5
|
Home-page: https://github.com/helloyie/akshare-proxy-patch
|
|
6
6
|
Author: cheapproxy.net
|
|
@@ -30,7 +30,7 @@ pip install --upgrade akshare-proxy-patch
|
|
|
30
30
|
|
|
31
31
|
## 使用
|
|
32
32
|
|
|
33
|
-
1. 访问 https://cheapproxy.net
|
|
33
|
+
1. 访问 https://cheapproxy.net 联系客服(备注: token),获取授权码 `AUTH_IP` 和 `AUTH_TOKEN`
|
|
34
34
|
|
|
35
35
|
2. 将 akshare 升级到最新
|
|
36
36
|
|
|
@@ -42,7 +42,7 @@ pip install --upgrade akshare
|
|
|
42
42
|
```
|
|
43
43
|
import akshare_proxy_patch
|
|
44
44
|
|
|
45
|
-
akshare_proxy_patch.install_patch("AUTH_TOKEN")
|
|
45
|
+
akshare_proxy_patch.install_patch("AUTH_IP", "AUTH_TOKEN")
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
# import akshare as ak
|
|
@@ -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.1.
|
|
8
|
+
version="0.1.4", # 版本号
|
|
9
9
|
author="cheapproxy.net",
|
|
10
10
|
author_email="emezxyj1@gmail.com",
|
|
11
11
|
description="AkShare 报错全局Hook",
|
|
File without changes
|
{akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/requires.txt
RENAMED
|
File without changes
|
{akshare_proxy_patch-0.1.2 → akshare_proxy_patch-0.1.4}/akshare_proxy_patch.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|