Home > Enterprise >  Issues download mega url via mega api in Python
Issues download mega url via mega api in Python

Time:07-10

My code :

from mega import Mega

mega_email = "emailhere"
mega_password = "paswordhere"

mega = Mega()
m = mega.login(mega_email, mega_password)

m.download_url('https://mega.co.nz/#!UHlR0QYK!JyPA8KCY4Hr8F-sFmiiVgIjNyYbCRiINAAAAAAAAAAA')

The login is all fine, everything here works except for the last line, where it downloads the url. You can make it download the url and specify the path and file name, which is optional. But even when doing that as well, the problem persists. The problem is :

Traceback (most recent call last):
  File "d:\Code\Python\test.py", line 11, in <module>
    m.download_url('https://mega.co.nz/#!UHlR0QYK!JyPA8KCY4Hr8F-sFmiiVgIjNyYbCRiINAAAAAAAAAAA')  
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\mega\mega.py", line 640, in download_url
    return self._download_file(
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\site-packages\mega\mega.py", line 741, in _download_file
    if (file_mac[0] ^ file_mac[1],
IndexError: tuple index out of range

CodePudding user response:

Python 3 may lag with 2 same variables at the sentence together so you should divide "mega = Mega()" with "m = mega.login" to get it working I think :p

hope it helps!

CodePudding user response:

The issue isn't with the code, rather with the module itself.

  • Related