Skip to content

Commit

Permalink
update move function
Browse files Browse the repository at this point in the history
  • Loading branch information
jnemery committed Jun 27, 2016
1 parent e5da9ed commit e38550a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ Move files
>>> from smartfile import BasicClient
>>> api = BasicClient()
>>> api.move('myfile.txt', '/Folder/')
>>> while True:
>>> try:
>>> s = self.get('/task', api['uuid'])
>>> # Sleep to assure the server doesn't get overloaded
>>> time.sleep(1)
>>> if s['result']['status'] == 'SUCCESS':
>>> break
>>> except Exception as e:
>>> print e
>>> break
Delete files
Expand Down
6 changes: 1 addition & 5 deletions smartfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ def move(self, src_path, dst_path):
# check destination folder for / at begining
if not dst_path.startswith("/"):
dst_path = "/" + dst_path
t = self.post('/path/oper/move/', src=src_path, dst=dst_path)
while True:
s = self.get('/task', t['uuid'])
if s['result']['status'] == 'SUCCESS':
break
return self.post('/path/oper/move/', src=src_path, dst=dst_path)


class BasicClient(Client):
Expand Down

0 comments on commit e38550a

Please sign in to comment.