def _message_from_token(self, token: Text, payload: Any) \
            -> Optional[BaseMessage]:
        """
        Analyzes a signed token and generates the matching message
        """

        try:
            tk = jwt.decode(token, settings.WEBVIEW_SECRET_KEY)
        except jwt.InvalidTokenError:
            return

        try:
            user_id = tk['fb_psid']
            assert isinstance(user_id, Text)
            page_id = tk['fb_pid']
            assert isinstance(page_id, Text)
        except (KeyError, AssertionError):
            return

        if self.settings()['page_id'] == page_id:
            return self._make_fake_message(user_id, page_id, payload)
def _message_from_token ( self , token : Text , payload : Any ) -> Optional [ BaseMessage ] : try : tk = jwt . decode ( token , settings . WEBVIEW_SECRET_KEY ) except jwt . InvalidTokenError : return try : user_id = tk [ 'fb_psid' ] assert isinstance ( user_id , Text ) page_id = tk [ 'fb_pid' ] assert isinstance ( page_id , Text ) except ( KeyError , AssertionError ) : return if self . settings ( ) [ 'page_id' ] == page_id : return self . _make_fake_message ( user_id , page_id , payload )
Analyzes a signed token and generates the matching message