diff --git a/README.md b/README.md index 3b78a73..39d9e7b 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ This is a work in progress, further functionality coming shortly. 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') ### Trash a file from URL or it's ID diff --git a/mega.py b/mega.py index 24e1d90..c9a8386 100644 --- a/mega.py +++ b/mega.py @@ -97,6 +97,9 @@ class Mega(object): file_key = path[1] 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): #parse file id and key from url if('!' in url): diff --git a/tests/test.py b/tests/test.py index fe22c28..8e8fcc3 100644 --- a/tests/test.py +++ b/tests/test.py @@ -25,7 +25,8 @@ def test(): #print(m.delete('C5pxAbr')) #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') if __name__ == '__main__':