def service_task(self, task_id):
     url = self.create_url('task/%s' % task_id)
     task = Task()
     while True:
         try:
             result = self.session.get(url=url, verify=False)
             result.raise_for_status()
         except requests.exceptions.RequestException as e:
             print(e)
             sys.exit(1)
         response = result.json()['response']
         if 'endTime' in response:
             return response
         else:
             task.wait(task_id)
         if response['isError'] == True:
             raise task.TaskError('Task %s had error %s' %
                                  (task_id, response['progress']))
     return response