Skip to main content

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')

Metadata

Release files for megaxdl 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for megaxdl 0.0.11
File Size Uploaded
megaxdl-0.0.11.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for megaxdl 0.0.11
File Interpreter ABI Platform
megaxdl-0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / megaxdl-0.0.11.tar.gz

Download URL megaxdl-0.0.11.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
286c31f93e03f5a4556805d340580a1bce446b0c23a945792fc8b272b0a59802
BLAKE2b-256 checksum
How to use checksums
d0ebca39f8a8ccb928dc009f0615609c05d0f7b3b2d6756582d986af9fec42f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / megaxdl-0.0.11-py3-none-any.whl

Download URL megaxdl-0.0.11-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a71a29158ce4d31435dd52c952eb29f610741361738b5801eb9cbd35160c23d
BLAKE2b-256 checksum
How to use checksums
65b41a0de67f6a2a723c1a7863f1e2c2236a64e026da30bb0f714c55b8bbd584
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.11 This release

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page