This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

项目背景

从2014年开始玩微信公众平台,试用过其中大多数的功能,如:消息回复、自定义菜单、公众号中的支付,页面授权等。之前的程序中都是直接调用公众平台的接口,这样复用功能无法实现。现将功能独立出单独模块

目前完成

  • 获取access_token方法
  • 获取微信服务器IP地址
  • 自定义菜单中的查询、创建、删除(不包括个性化菜单接口)
  • 消息管理中的接收普通消息、接收事件推送
  • 消息管理中的被动回复用户消息
  • 添加tornado代码的demo实例

使用示例

获取access_token方法

from wechat.base import get_access_token_dict

get_access_token_dict(APPID, APPSECRET)

消息处理基类

继承基础的消息处理类BaseHandler, 重写对应方法即可。 如文本、图片、视频等对应的处理方法分别问on_text、on_image、on_video。

from wechat.message import *

class MessageHandler(BaseHandler):

  def on_text(self, xml_dict):

      from_user = xml_dict['FromUserName']
      to_user = xml_dict['ToUserName']
      create_time = xml_dict['CreateTime']
      content = xml_dict['Content']

      text_response = TextResponse(from_user=to_user, to_user=from_user, create_time=create_time, content=content)
      return text_response

自定义菜单接口

from wechat.menu.client import Client

client = Client(access_token['access_token'])

# 创建菜单
client.create_menu(data)

# 获取菜单
client.get_menu()

# 删除菜单
client.delete_menu()

跑单元测试

nosetests --with-coverage --cover-package=wechat

下一步计划

  1. 继续补充其他常用接口

感兴趣的同学可以加入到项目中一起完善

Release History

Release History

1.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
wechat2-1.0.0.0.tar.gz (6.0 kB) Copy SHA256 Checksum SHA256 Source Sep 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting