
Research
Shai-Hulud Descends to Hades: Miasma Worm Campaign Spreads with New PyPI Wave
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.
akshare-proxy-patch
Advanced tools
针对 akshare、efinance、yfinance 的🐒插件补丁,解决
stock_zh_a_spot_em、stock_zh_a_hist、get_realtime_quotes等接口报错问题和 YahooYFRateLimitError问题。
akshare 接口报错问题efinance 接口报错问题yfinance Yahoo接口报错问题pip install akshare-proxy-patch==0.4.1
点击前往插件官网 获取 TOKEN。
akshare 或 efinance 用户:在 Python 文件最顶部添加如下代码,并替换 你的TOKEN。调用非常简单,不需要使用 AI 魔改。
# python 文件顶部添加如下代码
# 一定要放到最顶部!不能在 akshare 或 efinance 之后引入!
import akshare_proxy_patch
akshare_proxy_patch.install_patch(
"101.201.173.125",
auth_token="你的TOKEN",
retry=30,
# 封控的域名列表,可自行调整
hook_domains=[
"fund.eastmoney.com",
"push2.eastmoney.com",
"push2his.eastmoney.com",
"emweb.securities.eastmoney.com",
],
)
# --------------------------
# 后续你的正常业务代码保持不变
# --------------------------
# 假如你使用 akshare
import akshare as ak
df = ak.stock_zh_a_spot_em()
# 假如你使用 efinance
import efinance as ef
ef.stock.get_realtime_quotes()
yfinance 用户:在 Python 文件顶部添加如下代码,并替换 你的TOKEN。调用非常简单,不需要使用 AI 魔改。# python 文件顶部添加如下代码
# 一定要放到最顶部!不能在 akshare 或 efinance 之后引入!
import akshare_proxy_patch
akshare_proxy_patch.install_yfinance_patch(
"101.201.173.125",
auth_token="你的TOKEN",
retry=30,
)
# --------------------------
# 后续你的正常业务代码保持不变
# --------------------------
import yfinance as yf
data = yf.download("AAPL", start="2017-01-01", end="2017-04-30")
101.201.173.125 不可修改URL 包含数组中的其中一条,就会走插件。ak 或 ef 函数查看接口源码对应的 URL,根据封控情况细化可以降低积分消耗。stock_zh_a_spot_em 这个接口,hook_domains 可设置为 ["https://82.push2.eastmoney.com/api/qt/clist/get"]。加入如下代码后插件就会被禁用:
import importlib, requests;importlib.reload(requests)
下面是插件启用 --> 禁用 --> 再次启用的例子:
##### 1. 启用插件
import akshare_proxy_patch
akshare_proxy_patch.install_patch(
"101.201.173.125",
auth_token='你的TOKEN',
retry=30,
# 封控的域名列表,可自行调整
hook_domains=[
"fund.eastmoney.com",
"push2.eastmoney.com",
"push2his.eastmoney.com",
"emweb.securities.eastmoney.com",
],
)
import akshare as ak
df = ak.fund_etf_hist_em()
###### 2. 禁用插件
import importlib, requests;importlib.reload(requests)
# 禁用后测试
try:
df = ak.fund_etf_hist_em()
except Exception as e:
print('插件被禁用了,这里可能会报错')
##### 3. 再次启用插件,重复上述 1、2 的代码即可
aktools 想要集成插件,需要新建一个 akt.py 替换官方的 python -m aktools 启动命令,下面是 akt.py 内容:
# 添加插件
import akshare_proxy_patch
akshare_proxy_patch.install_patch(
"101.201.173.125",
auth_token="你的TOKEN",
retry=30,
# 封控的域名列表,可自行调整
hook_domains=[
"fund.eastmoney.com",
"push2.eastmoney.com",
"push2his.eastmoney.com",
"emweb.securities.eastmoney.com",
],
)
# 启动 aktools
import uvicorn
if __name__ == '__main__':
uvicorn.run(
"aktools.main:app",
host="0.0.0.0",
port=8080,
reload=False,
# 根据 CPU 核心数调整,推荐 2×核心数 + 1
workers=4,
log_level="info"
)
然后执行 python akt.py 即可启动一个 http://127.0.0.1:8080/ 服务。只是启动方式不同而已,使用请参考 aktools 官方文档。
requests 库请求接口,插件能自动 hook 住请求,正常工作。如使用时遇到问题,或对插件有什么意见或建议,可进群交流:

FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.