def __init__(self, subscription_info, requests_session=None):
if requests_session is None:<EOL><INDENT>self.requests_method = requests<EOL><DEDENT>else:<EOL><INDENT>self.requests_method = requests_session<EOL><DEDENT>if '<STR_LIT>' not in subscription_info:<EOL><INDENT>raise WebPushException("<STR_LIT>")<EOL><DEDENT>self.subscription_info = deepcopy(subscription_info)<EOL>self.auth_key = self.receiver_key = None<EOL>if '<STR_LIT>' in subscription_info:<EOL><INDENT>keys = self.subscription_info['<STR_LIT>']<EOL>for k in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>if keys.get(k) is None:<EOL><INDENT>raise WebPushException("<STR_LIT>".format(k))<EOL><DEDENT>if isinstance(keys[k], six.string_types):<EOL><INDENT>keys[k] = bytes(keys[k].encode('<STR_LIT:utf8>'))<EOL><DEDENT><DEDENT>receiver_raw = base64.urlsafe_b64decode(<EOL>self._repad(keys['<STR_LIT>']))<EOL>if len(receiver_raw) != <NUM_LIT> and receiver_raw[<NUM_LIT:0>] != "<STR_LIT>":<EOL><INDENT>raise WebPushException("<STR_LIT>")<EOL><DEDENT>self.receiver_key = receiver_raw<EOL>self.auth_key = base64.urlsafe_b64decode(<EOL>self._repad(keys['<STR_LIT>']))<EOL><DEDENT>
Initialize using the info provided by the client PushSubscription
        object (See
        https://developer.mozilla.org/en-US/docs/Web/API/PushManager/subscribe)

        :param subscription_info: a dict containing the subscription_info from
            the client.
        :type subscription_info: dict

        :param requests_session: a requests.Session object to optimize requests
            to the same client.
        :type requests_session: requests.Session