How to use the wechatpy.events.BaseEvent function in wechatpy

To help you get started, we’ve selected a few wechatpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jxtech / wechatpy / wechatpy / events.py View on Github external
@register_event('kf_create_session')
class KfCreateSessionEvent(BaseEvent):
    event = 'kf_create_session'
    account = StringField('KfAccount')


@register_event('kf_close_session')
class KfCloseSessionEvent(BaseEvent):
    event = 'kf_close_session'
    account = StringField('KfAccount')


@register_event('kf_switch_session')
class KfSwitchSessionEvent(BaseEvent):
    event = 'kf_switch_session'
    from_account = StringField('FromKfAccount')
    to_account = StringField('ToKfAccount')


@register_event('device_text')
class DeviceTextEvent(BaseEvent):
    event = 'device_text'
    device_type = StringField('DeviceType')
    device_id = StringField('DeviceID')
    session_id = StringField('SessionID')
    content = Base64DecodeField('Content')
    open_id = StringField('OpenID')


@register_event('device_bind')
github jxtech / wechatpy / wechatpy / events.py View on Github external
@register_event('qualification_verify_fail')
class QualificationVerifyFailEvent(BaseEvent):
    """
    资质认证失败事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'qualification_verify_fail'
    fail_time = DateTimeField('FailTime')
    fail_reason = StringField('FailReason')


@register_event('naming_verify_success')
class NamingVerifySuccessEvent(BaseEvent):
    """
    名称认证成功事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'naming_verify_success'
    expired_time = DateTimeField('ExpiredTime')


@register_event('naming_verify_fail')
class NamingVerifyFailEvent(BaseEvent):
    """
    名称认证失败事件

    客户端不打勾,但仍有接口权限。详情请参阅
github jxtech / wechatpy / wechatpy / events.py View on Github external
key = StringField('EventKey', '')


@register_event('unsubscribe')
class UnsubscribeEvent(BaseEvent):
    """
    用户取消关注事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1421140454
    """
    event = 'unsubscribe'


@register_event('subscribe_scan')
class SubscribeScanEvent(BaseEvent):
    """
    用户扫描二维码关注事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1421140454
    """
    event = 'subscribe_scan'
    scene_id = StringField('EventKey')
    ticket = StringField('Ticket')


@register_event('scan')
class ScanEvent(BaseEvent):
    """
    用户扫描二维码事件
github jxtech / wechatpy / wechatpy / events.py View on Github external
@register_event('update_invoice_status')
class UpdateInvoiceStatusEvent(BaseEvent):
    """
    发票状态更新事件

    详情请参考
    https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
    """
    event = 'update_invoice_status'
    status = StringField('Status')  # 发票报销状态
    card_id = StringField('CardId')  # 发票 Card ID
    code = StringField('Code')  # 发票 Code


@register_event('submit_invoice_title')
class SubmitInvoiceTitleEvent(BaseEvent):
    """
    用户提交发票抬头事件

    详情请参考
    https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
    """
    event = 'submit_invoice_title'
    title = StringField('title')  # 抬头
    phone = StringField('phone')  # 联系方式
    tax_no = StringField('tax_no')  # 税号
    addr = StringField('addr')  # 地址
    bank_type = StringField('bank_type')  # 银行类型
    bank_no = StringField('bank_no')  # 银行号码
    attach = StringField('attach')  # 附加字段
    title_type = StringField('title_type')  # 抬头类型,个人InvoiceUserTitlePersonType, 公司InvoiceUserTitleBusinessType
github jxtech / wechatpy / wechatpy / events.py View on Github external
@register_event('annual_renew')
class AnnualRenewEvent(BaseEvent):
    """
    年审通知事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'annual_renew'
    expired_time = DateTimeField('ExpiredTime')


@register_event('verify_expired')
class VerifyExpiredEvent(BaseEvent):
    """
    认证过期失效通知

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'verify_expired'
    expired_time = DateTimeField('ExpiredTime')


@register_event('user_scan_product')
class UserScanProductEvent(BaseEvent):
    """
    打开商品主页事件

    详情请参考
github jxtech / wechatpy / wechatpy / events.py View on Github external
if not beacons:
            return []

        ret = []
        for beacon in beacons['AroundBeacon']:
            ret.append({
                'uuid': beacon['Uuid'],
                'major': beacon['Major'],
                'minor': beacon['Minor'],
                'distance': float(beacon['Distance']),
            })
        return ret


@register_event('poi_check_notify')
class PoiCheckNotifyEvent(BaseEvent):
    event = 'poi_check_notify'
    poi_id = StringField('PoiId')
    uniq_id = StringField('UniqId')
    result = StringField('Result')
    message = StringField('Msg')


@register_event('wificonnected')
class WiFiConnectedEvent(BaseEvent):
    event = 'wificconnected'
    connect_time = IntegerField('ConnectTime')
    expire_time = IntegerField('ExpireTime')
    vendor_id = StringField('VendorId')
    shop_id = StringField('PlaceId')
    bssid = StringField('DeviceNo')
github jxtech / wechatpy / wechatpy / events.py View on Github external
@register_event('location')
class LocationEvent(BaseEvent):
    """
    上报地理位置事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1421140454
    """
    event = 'location'
    latitude = FloatField('Latitude', 0.0)
    longitude = FloatField('Longitude', 0.0)
    precision = FloatField('Precision', 0.0)


@register_event('click')
class ClickEvent(BaseEvent):
    """
    点击菜单拉取消息事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1421140454
    """
    event = 'click'
    key = StringField('EventKey')


@register_event('view')
class ViewEvent(BaseEvent):
    """
    点击菜单跳转链接事件

    详情请参阅
github jxtech / wechatpy / wechatpy / events.py View on Github external
"""
    event = 'scancode_push'


@register_event('scancode_waitmsg')
class ScanCodeWaitMsgEvent(BaseScanCodeEvent):
    """
    扫码推事件且弹出“消息接收中”提示框的事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1421141016
    """
    event = 'scancode_waitmsg'


class BasePictureEvent(BaseEvent):
    key = StringField('EventKey')
    pictures_info = BaseField('SendPicsInfo', {})

    @property
    def count(self):
        return int(self.pictures_info['Count'])

    @property
    def pictures(self):
        if self.pictures_info['PicList']:
            items = self.pictures_info['PicList']['item']
            if self.count > 1:
                return items
            return [items]
        return []
github jxtech / wechatpy / wechatpy / events.py View on Github external
@register_event('templatesendjobfinish')
class TemplateSendJobFinishEvent(BaseEvent):
    """
    模板消息任务完成事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1433751277
    """
    id = IntegerField('MsgID')
    event = 'templatesendjobfinish'
    status = StringField('Status')


class BaseScanCodeEvent(BaseEvent):
    key = StringField('EventKey')
    scan_code_info = BaseField('ScanCodeInfo', {})

    @property
    def scan_type(self):
        return self.scan_code_info['ScanType']

    @property
    def scan_result(self):
        return self.scan_code_info['ScanResult']


@register_event('scancode_push')
class ScanCodePushEvent(BaseScanCodeEvent):
    """
    扫码推事件
github jxtech / wechatpy / wechatpy / events.py View on Github external
详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1451025274
    """
    event = 'user_get_card'
    card_id = StringField('CardId')
    is_given_by_friend = IntegerField('IsGiveByFriend')
    friend = StringField('FriendUserName')
    code = StringField('UserCardCode')
    old_code = StringField('OldUserCardCode')
    outer_id = StringField('OuterId')
    outer_str = StringField('OuterStr')


@register_event('user_del_card')
class UserDeleteCardEvent(BaseEvent):
    """
    卡券删除事件推送

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1451025274
    """
    event = 'user_del_card'
    card_id = StringField('CardId')
    code = StringField('UserCardCode')


@register_event('submit_membercard_user_info')
class SubmitMembercardUserInfo(BaseEvent):
    """
    接收会员信息事件通知