Added d/l by id+key

This commit is contained in:
richard@richard.do 2013-02-05 07:11:15 +00:00
parent 4280bf8f67
commit ea50dfc90f
3 changed files with 7 additions and 3 deletions

View file

@ -26,8 +26,8 @@ This is a work in progress, further functionality coming shortly.
m.upload('myfile.doc') m.upload('myfile.doc')
### Download a file from URL ### Download a file from URL or it's ID,key combo
m.download('utYjgSTQ','OM4U3V5v_W4N5edSo0wolg1D5H0fwSrLD3oLnLuS9pc')
m.download_url('https://mega.co.nz/#!utYjgSTQ!OM4U3V5v_W4N5edSo0wolg1D5H0fwSrLD3oLnLuS9pc') m.download_url('https://mega.co.nz/#!utYjgSTQ!OM4U3V5v_W4N5edSo0wolg1D5H0fwSrLD3oLnLuS9pc')
### Trash a file from URL or it's ID ### Trash a file from URL or it's ID

View file

@ -97,6 +97,9 @@ class Mega(object):
file_key = path[1] file_key = path[1]
self.download_file(file_id, file_key, is_public=True) self.download_file(file_id, file_key, is_public=True)
def download(self, file_id, file_key):
self.download_file(file_id, file_key, is_public=True)
def parse_url(self, url): def parse_url(self, url):
#parse file id and key from url #parse file id and key from url
if('!' in url): if('!' in url):

View file

@ -25,7 +25,8 @@ def test():
#print(m.delete('C5pxAbr')) #print(m.delete('C5pxAbr'))
#print(m.delete_url('https://mega.co.nz/#!C5pxAbrL!SPxZH0Ovn2DLK_n5hLlkGQ2oTD8HcU6TYiz_TPg78kY')) #print(m.delete_url('https://mega.co.nz/#!C5pxAbrL!SPxZH0Ovn2DLK_n5hLlkGQ2oTD8HcU6TYiz_TPg78kY'))
#download file from url #download file, by id+key or url
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__':