Skip to main content

ewechat

以前有很多基于 Web 微信的库,比如 itchat 等,在微信限制 web 微信该协议后这些库就无法使用了。现在如果想 hook 微信出接口,基本都要使用一些付费的服务,比如 wechaty PadLocal,这也是我一直在用的服务,但是 wechaty 一直没有实现朋友圈等功能。

这个E 云管家也是基于微信 iPad 协议,价格和 PadLoacal 一样(每个微信号每月 200 元)。由于已经实现了我需要的朋友圈功能,所以最近把自己的服务迁移到了这里。

⚠️ 提示

我在使用这家服务,但并不作为推荐。与微信的 web 协议不同,如果使用这个服务,服务商可以获取你微信的全部隐私。而且这是对微信协议的破解,账号有被封禁的风险,请慎重使用。

开发进度

这个服务商的 API 接口非常简单,官方文档接口数量不多。为了方便我自己日常使用,我打算把官方 API 接口封装成 python SDK。代码比较简单,有时间的话我尽快写完。

使用方法

该包是基于服务商 API 实现的,请在服务商处注册并购买相应资源后再进行配置。请先阅读服务商文档,否则可能不理解相关的参数。

下载安装该包:

python3 -m pip install ewechat

登录

from ewechat import Wechat

# 实例化时请传入服务商提供的 url、账号和密码,
# 目的是为了获得授权码
my_wechat = Wechat(base_url=url, account="your_account", password="your_password")

# 如果已经获得了授权码,可以直接传入授权码
my_wechat = Wechat(base_url=url, auth=authorization)

# 进行登录,在弹出二维码后请用手机扫码登录
my_wechat.login()
# 如果是在远程主机运行,无法弹出二维码,需要手动打开图片扫码后执行
my_wechat.write_file()

# 登录完成后会在当前目录创建文件 logged_in
# 记录你的一些参数,参数的意义请参照服务商文档

通讯录

初始化通讯录列表

my_wechat.init_address_list()

获取通讯录列表

my_wechat.get_address_list()

获取联系人信息

my_wechat.get_contact(wcId: str)

消息发送

发送文本消息

my_wechat.send_text(wcId: str, content: str)

发送文件消息

my_wechat.send_file(wcId: str, path: str, fileName: str)

发送图片消息

my_wechat.send_image(wcId: str, content: str)

发送视频消息

my_wechat.send_video(path: str, thumbPath: str)

发送 URL 消息

my_wechat.send_url(wcId, title, url, description, thumbUrl)

消息接收

设置消息接收地址

返回 None 即设置成功,如果设置失败会引发异常。

my_wechat.set_http_callback_url(httpUrl: str, type: int)

取消消息接收

my_wechat.cancel_http_callback_url()

下载图片

type 0 是常规图片,1 是高清图。

my_wechat.get_msg_img(msgId: str, content: str, type: int = 1)

朋友圈

获取指定好友朋友圈

第一次使用 firstPageMd5 和 maxId 请留空。

my_wechat.get_friend_circle(wcId: str, firstPageMd5: str = "", maxId: int = 0)

发送文字朋友圈

my_wechat.sns_send(content: str)

发送图片朋友圈

my_wechat.sns_send_image(content: str, paths: str, groupUser: str = None, blackList: str = None)

Metadata

Release files for ewechat 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ewechat 0.1.6
File Size Uploaded Provenance
ewechat-0.1.6.tar.gz 8.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ewechat 0.1.6
File Interpreter ABI Platform
ewechat-0.1.6-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.1 kB

Release files / ewechat-0.1.6.tar.gz

Download URL ewechat-0.1.6.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d3f64b6b29640f3639b6227d14dcf446d7e8b88d935fa26d4608751a4d0f240e
BLAKE2b-256 checksum
How to use checksums
f39c315f1f07533036b9235f8201355b8203cb349847754bd731b975944180cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / ewechat-0.1.6-py2.py3-none-any.whl

Download URL ewechat-0.1.6-py2.py3-none-any.whl
Size 8.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
36037defe6c154a4ddf5b85eb4ea3e813d0d652e2050e61463eeffacfb93f2b2
BLAKE2b-256 checksum
How to use checksums
15be183ab0107eb599d3723b7fae0ab8a9fd14574b168e517c536d98b142945e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Security for ewechat 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page