Commit 8b2e0e0c authored by richardARPANET's avatar richardARPANET


parent 7bc9caba
......@@ -2,7 +2,6 @@ import re
import json
import logging
import secrets
import time
from pathlib import Path
import hashlib
from Crypto.Cipher import AES
......@@ -13,7 +12,6 @@ import random
import binascii
import tempfile
import shutil
from threading import RLock
import functools
from joblib import Memory
......@@ -33,10 +31,8 @@ location = '/tmp'
memory = Memory(location, verbose=0)
def _log_request_failed(*args, **kwargs):
'Request failed, sleeping then retrying... %s %s', args, kwargs
def _log_request_failed(*args, sleep, **kwargs):'Request failed, sleeping %s then retrying...', sleep)
def write_operation(method):
......@@ -61,10 +57,11 @@ class Mega:
if options is None:
options = {}
self.options = options
self.get_files = memory.cache(self.get_files)
# self.get_files = memory.cache(self.get_files)
def _clear_cache(self):
# memory.clear(warn=False)
def login(self, email=None, password=None):
if email:
......@@ -191,6 +188,11 @@ class Mega:
json_resp = json.loads(req.text)
if isinstance(json_resp, int):
if json_resp == -3:
action = data[0]['a']
except KeyError:
action = 'unknown''Request failed for action: %s', action)
raise RuntimeError('Request failed, retrying')
raise RequestError(json_resp)
return json_resp[0]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment