megapy/tests/test.py

32 lines
691 B
Python
Raw Normal View History

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