def __init__(self, signed_request=None, application_secret_key=None, application_id=None, api_version=None):
        """
        Initialize a signed request.

        :param signed_request: A string describing a signed request.
        :param application_secret_key: A string describing a Facebook application's secret key.
        """
        self.signed_request = signed_request
        self.application_secret_key = application_secret_key
        self.application_id = application_id
        self.api_version = api_version

        self.raw = self.parse(signed_request, application_secret_key)

        self.data = self.raw.get('app_data', None)

        self.page = self.Page(
            id=self.raw['page'].get('id'),
            is_liked=self.raw['page'].get('liked'),
            is_admin=self.raw['page'].get('admin')
        ) if 'page' in self.raw else None

        if 'user' not in self.raw:
            self.fetch_user_data_and_token()

        self.user = self.User(
            id=self.raw.get('user_id'),
            locale=self.raw['user'].get('locale', None),
            country=self.raw['user'].get('country', None),
            age=range(
                self.raw['user']['age']['min'],
                self.raw['user']['age']['max'] + 1 if 'max' in self.raw['user']['age'] else 100
            ) if 'age' in self.raw['user'] else None,
            oauth_token=self.User.OAuthToken(
                token=self.raw['oauth_token'],
                issued_at=datetime.fromtimestamp(self.raw['issued_at']),
                expires_at=datetime.fromtimestamp(self.raw['expires']) if self.raw['expires'] > 0 else None
            ) if 'oauth_token' in self.raw else None,
        )
dataset/ETHPy150Open jgorset/facepy/facepy/signed_request.py/SignedRequest.__init__/original