(self, message)
| 91 | @handle_for_type('event') |
| 92 | class EventMessage(WechatMessage): |
| 93 | def __init__(self, message): |
| 94 | message.pop('type') |
| 95 | try: |
| 96 | self.type = message.pop('Event').lower() |
| 97 | if self.type == 'subscribe' or self.type == 'scan': |
| 98 | self.key = message.pop('EventKey', None) |
| 99 | self.ticket = message.pop('Ticket', None) |
| 100 | elif self.type in ['click', 'scancode_push', 'scancode_waitmsg', |
| 101 | 'pic_sysphoto', 'pic_photo_or_album', 'pic_weixin', 'location_select']: |
| 102 | self.key = message.pop('EventKey', None) |
| 103 | elif self.type == 'view': |
| 104 | self.key = message.pop('EventKey', None) |
| 105 | self.menu_id = message.pop('MenuId', None) |
| 106 | elif self.type == 'location': |
| 107 | self.latitude = float(message.pop('Latitude', '0')) |
| 108 | self.longitude = float(message.pop('Longitude', '0')) |
| 109 | self.precision = float(message.pop('Precision', '0')) |
| 110 | elif self.type == 'templatesendjobfinish': |
| 111 | self.status = message.pop('Status', None) |
| 112 | except KeyError: |
| 113 | raise ParseError() |
| 114 | super(EventMessage, self).__init__(message) |
| 115 | |
| 116 | |
| 117 | @handle_for_type('voice') |
nothing calls this directly
no test coverage detected