megapy/tests/test.py
2013-02-04 21:15:18 +00:00

32 lines
No EOL
691 B
Python

from mega import Mega
def test():
#user details
email = 'your@email.com'
password = 'password'
mega = Mega()
#login
m = mega.login(email, password)
#get user details
details = m.get_user()
print(details)
#get account files
files = m.get_files()
print(files)
#upload file
print(m.upload('test.py'))
#trash a file, by id or url
#print(m.delete('C5pxAbr'))
#print(m.delete_url('https://mega.co.nz/#!C5pxAbrL!SPxZH0Ovn2DLK_n5hLlkGQ2oTD8HcU6TYiz_TPg78kY'))
#download file from url
m.download_url('https://mega.co.nz/#!6hBW0R4a!By7-Vjj5xal8K5w_IXH3PlGNyZ1VvIrjZkOmHGq1X00')
if __name__ == '__main__':
test()