Skip to main content

千寻微信框架SDK包

Project description

千寻微信框架的 Python SDK

介绍

千寻微信框架的 Python SDK,基于千寻微信框架的 HTTP API 接口,封装了一些常用的接口,方便开发者使用。

安装

pip install qianxun-wechat-sdk

使用示例

import qianxun.Emoji as Emoji       # 导入 qianxun Emoji 表情模块
from qianxun.SDK import Robot       # 导入 qianxun SDK 框架

# 创建一个回调函数来接收 qianxun 框架的回调事件
def callback(request):
    print('=' * 50 + '回调事件' + '=' * 50, end='\n\n')
    print(request)

    if request['event'] == 10014:
        print('账号变动事件(10014)')

    if request['event'] == 10008:
        print('收到群聊消息(10008)')

    if request['event'] == 10009:
        print('收到私聊消息(10009)')

    if request['event'] == 10010:
        print('自己发出消息(10010)')

    if request['event'] == 10006:
        print('收到转账事件(10006)')

    if request['event'] == 10013:
        print('撤回事件(10013)')

    if request['event'] == 10011:
        print('好友请求(10011)')

    if request['event'] == 10007:
        print('支付事件(10007)')


if __name__ == '__main__':

    # 创建一个机器人实例,传入机器人的 ip 和端口,以及机器人的 wxid (可选)
    robot = Robot(host='127.0.0.1', port=7777, bot_wxid='')

    # 调用机器人的登录接口, 获取机器人的 wxid
    robot.bot_wxid = robot.getWeChatList()['result'][0]['wxid']

    # 创建一个机器人的回调事件,传入回调函数和端口
    robot.callbackEvents(callback_fun=callback, port=5000)

    # 调用机器人的发送文本消息接口,传入机器人的 wxid 和消息内容
    robot.sendTextMessage(wxid='filehelper', msg=f'你好 {Emoji.小丑脸} 测试 {Emoji.表情_捂脸}')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qianxun-wechat-sdk-0.0.3.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qianxun_wechat_sdk-0.0.3-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file qianxun-wechat-sdk-0.0.3.tar.gz.

File metadata

  • Download URL: qianxun-wechat-sdk-0.0.3.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for qianxun-wechat-sdk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9709ff73a208929e364bd6f1ebcf7ce648e3f06ce87d3e49a88a1492378724c9
MD5 d23e7f0b895178188549de89dfab8d49
BLAKE2b-256 380abadb3c53f03c760fbb288b08404860e44c348a9c30bc88b8b2da7fa163c3

See more details on using hashes here.

File details

Details for the file qianxun_wechat_sdk-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for qianxun_wechat_sdk-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7428244da3f6504bbc80dd3d67e2a5f1b1048850cca2776b035c8c5b1a08070c
MD5 40bc3ab2ef4e61274aa27dbc3dccf650
BLAKE2b-256 e4f3208c4907c09bc8c723b061da2d575dfcc88c77a7761eacc96ea6d9900d02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page