prepare for taskStatus api change
This commit is contained in:
parent
252158a216
commit
bdca487883
1 changed files with 5 additions and 2 deletions
|
@ -955,16 +955,19 @@ class API(ox.API):
|
||||||
tmp = tempfile.gettempdir()
|
tmp = tempfile.gettempdir()
|
||||||
self._resume_file = os.path.join(tmp, 'pandora_client.%s.%s.json' % (os.environ.get('USER'), netloc))
|
self._resume_file = os.path.join(tmp, 'pandora_client.%s.%s.json' % (os.environ.get('USER'), netloc))
|
||||||
|
|
||||||
|
if hasattr(self, 'taskStatus') and not hasattr(self, 'getTaskStatus'):
|
||||||
|
self.getTaskStatus = self.taskStatus
|
||||||
|
|
||||||
def async(self, action, data, interval=5):
|
def async(self, action, data, interval=5):
|
||||||
t = r = getattr(self, action)(data)
|
t = r = getattr(self, action)(data)
|
||||||
if r['status']['code'] == 200:
|
if r['status']['code'] == 200:
|
||||||
# wait for async task to finish
|
# wait for async task to finish
|
||||||
if 'taskId' in r['data']:
|
if 'taskId' in r['data']:
|
||||||
t = self.taskStatus(task_id=r['data']['taskId'])
|
t = self.getTaskStatus(task_id=r['data']['taskId'])
|
||||||
print 'waiting for server ...'
|
print 'waiting for server ...'
|
||||||
while t['data'].get('status') == 'PENDING':
|
while t['data'].get('status') == 'PENDING':
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
t = self.taskStatus(task_id=r['data']['taskId'])
|
t = self.getTaskStatus(task_id=r['data']['taskId'])
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def uploadFrames(self, i, data):
|
def uploadFrames(self, i, data):
|
||||||
|
|
Loading…
Reference in a new issue