akshare-proxy-patch 0.2.10__tar.gz → 0.2.12__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.10
3
+ Version: 0.2.12
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
@@ -29,7 +29,7 @@ Dynamic: requires-python
29
29
  2. 安装 `akshare-proxy-patch` 插件
30
30
 
31
31
  ```
32
- pip install akshare-proxy-patch==0.2.9
32
+ pip install akshare-proxy-patch==0.2.11
33
33
  ```
34
34
 
35
35
  ## 使用方法
@@ -9,7 +9,7 @@
9
9
  2. 安装 `akshare-proxy-patch` 插件
10
10
 
11
11
  ```
12
- pip install akshare-proxy-patch==0.2.9
12
+ pip install akshare-proxy-patch==0.2.11
13
13
  ```
14
14
 
15
15
  ## 使用方法
@@ -3,7 +3,7 @@ import threading
3
3
  import requests
4
4
  from urllib.parse import urlparse
5
5
 
6
- __version__ = "0.2.10"
6
+ __version__ = "0.2.12"
7
7
  # 备份 Session 的原始 request 方法,这是所有 requests.get/post 的最终入口
8
8
  _original_request = requests.Session.request
9
9
  _auth_session = requests.Session()
@@ -58,11 +58,13 @@ def install_patch(auth_ip, auth_token, retry=30):
58
58
  "fund.eastmoney.com",
59
59
  "push2.eastmoney.com",
60
60
  "push2his.eastmoney.com",
61
+ "emweb.securities.eastmoney.com",
61
62
  ]
62
63
  )
63
64
  is_js = urlparse(url or "").path.lower().endswith(".js")
65
+ is_html = urlparse(url or "").path.lower().endswith(".html")
64
66
 
65
- if not is_target or is_js:
67
+ if not is_target or is_js or is_html:
66
68
  return _original_request(self, method, url, **kwargs)
67
69
 
68
70
  auth_url = f"http://{auth_ip}:47001/api/akshare-auth"
@@ -93,6 +95,9 @@ def install_patch(auth_ip, auth_token, retry=30):
93
95
  resp = _original_request(self, method, url, **kwargs)
94
96
  if resp.ok:
95
97
  try:
98
+ content_type = resp.headers.get("Content-Type").lower()
99
+ if "json" not in content_type:
100
+ return resp
96
101
  _ = resp.json()
97
102
  return resp
98
103
  except:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-proxy-patch
3
- Version: 0.2.10
3
+ Version: 0.2.12
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
@@ -29,7 +29,7 @@ Dynamic: requires-python
29
29
  2. 安装 `akshare-proxy-patch` 插件
30
30
 
31
31
  ```
32
- pip install akshare-proxy-patch==0.2.9
32
+ pip install akshare-proxy-patch==0.2.11
33
33
  ```
34
34
 
35
35
  ## 使用方法
@@ -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.10"
7
+ version = "0.2.12"
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.10",
8
+ version="0.2.12",
9
9
  author="cheapproxy.net",
10
10
  author_email="emezxyj1@gmail.com",
11
11
  description="AkShare 和 efinance 报错全局Hook",