Пример #1
0
 def _process_event_request(self, event):
     """Do the event post request"""
     event.status = Event.STATUS_REQUESTED
     # Request attempts can be made up to a maximum of 3 times per event
     LOG.info('EVENT [{}] - Executing request', event)
     endpoint_url = ENDPOINTS['events'] + create_req_params(
         20 if event.event_type == EVENT_START else 0,
         'events/{}'.format(event))
     try:
         response = self.chunked_request(endpoint_url,
                                         event.request_data,
                                         get_esn(),
                                         disable_msl_switch=False)
         # Malformed/wrong content in requests are ignored without returning error feedback in the response
         event.set_response(response)
     except Exception as exc:  # pylint: disable=broad-except
         LOG.error('EVENT [{}] - The request has failed: {}', event, exc)
         event.set_response('RequestError')
     if event.event_type == EVENT_STOP and event.status == Event.STATUS_SUCCESS:
         self.clear_queue()
         if event.event_data['allow_request_update_loco']:
             # Calls to nfsession
             common.make_http_call('update_loco_context',
                                   {'context_name': 'continueWatching'})
             common.make_http_call('update_videoid_bookmark',
                                   {'video_id': event.get_video_id()})
     return True
Пример #2
0
 def _get_owner_user_id_token(self):
     """A way to get the user token id of owner profile"""
     # In order to get a user id token of another (non-owner) profile you must make a request with SWITCH_PROFILE
     # authentication scheme (a custom authentication for netflix), and this request can be directly included
     # in the MSL manifest request.
     # But in order to execute this switch profile, you need to have the user id token of the main (owner) profile.
     # The only way (found to now) to get it immediately, is send a logblob event request, and save the
     # user id token obtained in the response.
     LOG.debug('Requesting logblog')
     endpoint_url = ENDPOINTS['logblobs'] + create_req_params(0, 'bind')
     response = self.chunked_request(endpoint_url,
                                     self.build_request_data(
                                         '/logblob',
                                         generate_logblobs_params()),
                                     get_esn(),
                                     force_auth_credential=True)
     LOG.debug('Response of logblob request: {}', response)