Improved dest_id upload() check

This commit is contained in:
richard@richard.do 2013-02-05 07:45:03 +00:00
parent ea50dfc90f
commit 07a5248fa1
2 changed files with 6 additions and 5 deletions

View file

@ -239,8 +239,9 @@ class Mega(object):
#determine storage node #determine storage node
if dest is None: if dest is None:
#if none set, upload to cloud drive node #if none set, upload to cloud drive node
root_id = getattr(self, 'root_id') if hasattr(self, 'root_id'):
if root_id is None: root_id = getattr(self, 'root_id')
else:
self.get_files() self.get_files()
dest = self.root_id dest = self.root_id

View file

@ -22,11 +22,11 @@ def test():
print(m.upload('test.py')) print(m.upload('test.py'))
#trash a file, by id or url #trash a file, by id or url
#print(m.delete('C5pxAbr')) #print(m.delete('f14U0JhD'))
#print(m.delete_url('https://mega.co.nz/#!C5pxAbrL!SPxZH0Ovn2DLK_n5hLlkGQ2oTD8HcU6TYiz_TPg78kY')) #print(m.delete_url('https://mega.co.nz/#!f14U0JhD!S_2k-EvB5U1N3s0vm3I5C0JN2toHSGkVf0UxQsiKZ8A'))
#download file, by id+key or url #download file, by id+key or url
m.download('6hBW0R4a','By7-Vjj5xal8K5w_IXH3PlGNyZ1VvIrjZkOmHGq1X00') #m.download('6hBW0R4a','By7-Vjj5xal8K5w_IXH3PlGNyZ1VvIrjZkOmHGq1X00')
m.download_url('https://mega.co.nz/#!6hBW0R4a!By7-Vjj5xal8K5w_IXH3PlGNyZ1VvIrjZkOmHGq1X00') m.download_url('https://mega.co.nz/#!6hBW0R4a!By7-Vjj5xal8K5w_IXH3PlGNyZ1VvIrjZkOmHGq1X00')
if __name__ == '__main__': if __name__ == '__main__':