Skip to main content

No project description provided

Project description

Megaxdl

Python library for the Mega.nz API, currently supporting:

  • login
  • sharing
  • renaming
  • deleting
  • searching
  • uploading
  • downloading
  • moving files

How To Use

Create a Mega account

For downloading links, no account is needed. To use upload capabilities, create an account with Mega .

Install megaxdl package

pip install megaxdl

Import Mega

from Megaxdl import Mega

Create an instance of Mega

mega = Mega()

Login to Mega

m = mega.login(email, password)
# login using a temporary anonymous account
m = mega.login()

Get user details

details = m.get_user()

Get account balance (Pro accounts only)

balance = m.get_balance()

Get account disk quota

quota = m.get_quota()

Get account storage space

# specify unit output kilo, mega, gig, else bytes will output
space = m.get_storage_space(kilo=True)

Get account files

files = m.get_files()

Upload a file, and get its public link

file = m.upload('myfile.doc')
m.get_upload_link(file)
# see mega.py for destination and filename options

Export a file or folder

public_exported_web_link = m.export('myfile.doc')
public_exported_web_link = m.export('my_mega_folder/my_sub_folder_to_share')
# e.g. https://mega.nz/#F!WlVl1CbZ!M3wmhwZDENMNUJoBsdzFng

Find a file or folder

folder = m.find('my_mega_folder')
# Excludes results which are in the Trash folder (i.e. deleted)
folder = m.find('my_mega_folder', exclude_deleted=True)

Upload a file to a destination folder

folder = m.find('my_mega_folder')
m.upload('myfile.doc', folder[0])

Download a file from URL or file obj, optionally specify destination folder

file = m.find('myfile.doc')
m.download(file)
m.download_url('https://mega.nz/#!utYjgSTQ!OM4U3V5v_W4N5edSo0wolg1D5H0fwSrLD3oLnLuS9pc')
m.download(file, '/home/john-smith/Desktop')
# specify optional download filename (download_url() supports this also)
m.download(file, '/home/john-smith/Desktop', 'myfile.zip')

Import a file from URL, optionally specify destination folder

m.import_public_url('https://mega.nz/#!utYjgSTQ!OM4U3V5v_W4N5edSo0wolg1D5H0fwSrLD3oLnLuS9pc')
folder_node = m.find('Documents')[1]
m.import_public_url('https://mega.nz/#!utYjgSTQ!OM4U3V5v_W4N5edSo0wolg1D5H0fwSrLD3oLnLuS9pc', dest_node=folder_node)

Create a folder

m.create_folder('new_folder')
m.create_folder('new_folder/sub_folder/subsub_folder')

Returns a dict of folder node name and node_id, e.g.

{
  'new_folder': 'qpFhAYwA',
  'sub_folder': '2pdlmY4Z',
  'subsub_folder': 'GgMFCKLZ'
}

Rename a file or a folder

file = m.find('myfile.doc')
m.rename(file, 'my_file.doc')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

megaxdl-0.0.5.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

megaxdl-0.0.5-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file megaxdl-0.0.5.tar.gz.

File metadata

  • Download URL: megaxdl-0.0.5.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for megaxdl-0.0.5.tar.gz
Algorithm Hash digest
SHA256 4ad48cf42f0acd3ec9551e2a003dbd74f48d367d02f40dfc77cf6c98ba9767e7
MD5 445c2c5ea83a6f69c3b6d74bd268464c
BLAKE2b-256 603fa8da5cd9f31fd2235909cc7e188b69f617c0f130fa0308d560112adae55c

See more details on using hashes here.

File details

Details for the file megaxdl-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: megaxdl-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for megaxdl-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c8ca31223b9f1bc3bf6bb665bb2964c5ce6680847ac9c7ac5ee84d5d951cfd2d
MD5 7b76e524369f67e208d3538420934d0e
BLAKE2b-256 d885f7eafe5543ecd346f86ecdd23b113ab4fdd609b136aaf3b73aa2194a65e9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page