Ejemplo n.º 1
0
    def test_datetime_field_to_xml(self):
        from wechatpy.fields import DateTimeField
        from wechatpy.fields import default_timezone

        content = 1442401156
        content = datetime.fromtimestamp(content, tz=default_timezone)
        field = DateTimeField('ExpiredTime')
        expected = '<ExpiredTime>1442401156</ExpiredTime>'
        self.assertEqual(expected, field.to_xml(content))
Ejemplo n.º 2
0
class QualificationVerifySuccessEvent(BaseEvent):
    """
    资质认证成功事件

    详情请参阅
    http://mp.weixin.qq.com/wiki/1/7f81dec16b801b34629091094c099439.html
    """
    event = 'qualification_verify_success'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 3
0
class QualificationVerifySuccessEvent(BaseEvent):
    """
    资质认证成功事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'qualification_verify_success'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 4
0
class VerifyExpiredEvent(BaseEvent):
    """
    认证过期失效通知

    详情请参阅
    http://mp.weixin.qq.com/wiki/1/7f81dec16b801b34629091094c099439.html
    """
    event = 'verify_expired'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 5
0
class VerifyExpiredEvent(BaseEvent):
    """
    认证过期失效通知

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'verify_expired'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 6
0
class AnnualRenewEvent(BaseEvent):
    """
    年审通知事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'annual_renew'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 7
0
class NamingVerifySuccessEvent(BaseEvent):
    """
    名称认证成功事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'naming_verify_success'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 8
0
class AnnualRenewEvent(BaseEvent):
    """
    年审通知事件

    详情请参阅
    http://mp.weixin.qq.com/wiki/1/7f81dec16b801b34629091094c099439.html
    """
    event = 'annual_renew'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 9
0
class NamingVerifySuccessEvent(BaseEvent):
    """
    名称认证成功事件

    详情请参阅
    http://mp.weixin.qq.com/wiki/1/7f81dec16b801b34629091094c099439.html
    """
    event = 'naming_verify_success'
    expired_time = DateTimeField('ExpiredTime')
Ejemplo n.º 10
0
class NamingVerifyFailEvent(BaseEvent):
    """
    名称认证失败事件

    客户端不打勾,但仍有接口权限。详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'naming_verify_fail'
    fail_time = DateTimeField('FailTime')
    fail_reason = StringField('FailReason')
Ejemplo n.º 11
0
class VerifyExpiredEvent(BaseEvent):
    """
    认证过期失效通知

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Account_Management/Wechat_Accreditation_Event_Push.html
    """

    event = "verify_expired"
    expired_time = DateTimeField("ExpiredTime")
Ejemplo n.º 12
0
class QualificationVerifyFailEvent(BaseEvent):
    """
    资质认证失败事件

    详情请参阅
    https://mp.weixin.qq.com/wiki?id=mp1455785130
    """
    event = 'qualification_verify_fail'
    fail_time = DateTimeField('FailTime')
    fail_reason = StringField('FailReason')
Ejemplo n.º 13
0
class NamingVerifyFailEvent(BaseEvent):
    """
    名称认证失败事件

    客户端不打勾,但仍有接口权限。详情请参阅
    http://mp.weixin.qq.com/wiki/1/7f81dec16b801b34629091094c099439.html
    """
    event = 'naming_verify_fail'
    fail_time = DateTimeField('FailTime')
    fail_reason = StringField('FailReason')
Ejemplo n.º 14
0
class AnnualRenewEvent(BaseEvent):
    """
    年审通知事件

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Account_Management/Wechat_Accreditation_Event_Push.html
    """

    event = "annual_renew"
    expired_time = DateTimeField("ExpiredTime")
Ejemplo n.º 15
0
class NamingVerifySuccessEvent(BaseEvent):
    """
    名称认证成功事件

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Account_Management/Wechat_Accreditation_Event_Push.html
    """

    event = "naming_verify_success"
    expired_time = DateTimeField("ExpiredTime")
Ejemplo n.º 16
0
class QualificationVerifyFailEvent(BaseEvent):
    """
    资质认证失败事件

    详情请参阅
    http://mp.weixin.qq.com/wiki/1/7f81dec16b801b34629091094c099439.html
    """
    event = 'qualification_verify_fail'
    fail_time = DateTimeField('FailTime')
    fail_reason = StringField('FailReason')
Ejemplo n.º 17
0
class NamingVerifyFailEvent(BaseEvent):
    """
    名称认证失败事件

    客户端不打勾,但仍有接口权限。详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Account_Management/Wechat_Accreditation_Event_Push.html
    """

    event = "naming_verify_fail"
    fail_time = DateTimeField("FailTime")
    fail_reason = StringField("FailReason")
Ejemplo n.º 18
0
class QualificationVerifyFailEvent(BaseEvent):
    """
    资质认证失败事件

    详情请参阅
    https://developers.weixin.qq.com/doc/offiaccount/Account_Management/Wechat_Accreditation_Event_Push.html
    """

    event = "qualification_verify_fail"
    fail_time = DateTimeField("FailTime")
    fail_reason = StringField("FailReason")
Ejemplo n.º 19
0
class BaseComponentMessage(metaclass=MessageMetaClass):
    """Base class for all component messages and events"""

    type = "unknown"
    appid = StringField("AppId")
    create_time = DateTimeField("CreateTime")

    def __init__(self, message):
        self._data = message

    def __repr__(self):
        return f"{self.__class__.__name__}({repr(self._data)})"
Ejemplo n.º 20
0
class BaseComponentMessage(metaclass=MessageMetaClass):
    """Base class for all component messages and events"""
    type = 'unknown'
    appid = StringField('AppId')
    create_time = DateTimeField('CreateTime')

    def __init__(self, message):
        self._data = message

    def __repr__(self):
        s = "{klass}({msg})".format(klass=self.__class__.__name__,
                                    msg=repr(self._data))
        return s
Ejemplo n.º 21
0
class BaseMessage(metaclass=MessageMetaClass):
    """Base class for all messages and events"""

    type = "unknown"
    id = IntegerField("MsgId", 0)
    source = StringField("FromUserName")
    target = StringField("ToUserName")
    create_time = DateTimeField("CreateTime")
    time = IntegerField("CreateTime")

    def __init__(self, message):
        self._data = message

    def __repr__(self):
        return f"{self.__class__.__name__}({repr(self._data)})"
Ejemplo n.º 22
0
class BaseComponentMessage(six.with_metaclass(MessageMetaClass)):
    """Base class for all component messages and events"""
    type = 'unknown'
    appid = StringField('AppId')
    create_time = DateTimeField('CreateTime')

    def __init__(self, message):
        self._data = message

    def __repr__(self):
        _repr = "{klass}({msg})".format(klass=self.__class__.__name__,
                                        msg=repr(self._data))
        if six.PY2:
            return to_binary(_repr)
        else:
            return to_text(_repr)
Ejemplo n.º 23
0
class BaseMessage(metaclass=MessageMetaClass):
    """Base class for all messages and events"""
    type = 'unknown'
    id = IntegerField('MsgId', 0)
    source = StringField('FromUserName')
    target = StringField('ToUserName')
    create_time = DateTimeField('CreateTime')
    time = IntegerField('CreateTime')

    def __init__(self, message):
        self._data = message

    def __repr__(self):
        _repr = "{klass}({msg})".format(klass=self.__class__.__name__,
                                        msg=repr(self._data))
        return _repr
Ejemplo n.º 24
0
class WeappAuditSuccessEvent(BaseEvent):
    """
    从菜单进入小程序事件
    """
    event = 'weapp_audit_success'
    success_time = DateTimeField('SuccTime')  # 小程序路径