return document id without extra call
This commit is contained in:
parent
3c10815073
commit
57145534ca
1 changed files with 6 additions and 5 deletions
|
@ -866,12 +866,10 @@ class Client(object):
|
|||
did = self.find_document(oshash)
|
||||
if not did:
|
||||
url = '%supload/document/' % self._config['url']
|
||||
r = self.api.upload_chunks(url, f, {
|
||||
did = self.api.upload_chunks(url, f, {
|
||||
'filename': os.path.basename(f)
|
||||
})
|
||||
if r and item:
|
||||
did = self.find_document(oshash)
|
||||
if item:
|
||||
if did and item:
|
||||
r = self.api.addDocument({
|
||||
'id': did,
|
||||
'item': item
|
||||
|
@ -1210,7 +1208,10 @@ class API(ox.API):
|
|||
print(' ' * 80)
|
||||
print('')
|
||||
show_cursor()
|
||||
return data and 'result' in data and data.get('result') == 1
|
||||
if data and 'result' in data and data.get('result') == 1:
|
||||
return data.get('id', True)
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
if DEBUG:
|
||||
if 'status' in data and data['status']['code'] == 401:
|
||||
|
|
Loading…
Reference in a new issue