You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I try to learn mega at this moment
so I did a little prog:
#-*- encoding: utf-8 -*-
import sys
import os
import cmd
import time
_wrapper_dir = os.getcwd()
_libs_dir = os.path.join(_wrapper_dir, '.libs')
_shared_lib = os.path.join(_libs_dir, '_mega.so')
if os.path.isdir(_wrapper_dir) and os.path.isfile(_shared_lib):
sys.path.insert(0, _wrapper_dir) # mega.py
sys.path.insert(0, _libs_dir) # _mega.so
from mega import *
class Listner(MegaListener):
def __init__(self, v, api):
self.v = v
super(Listner, self).__init__()
def onRequestStart(self, *args):
print "request: {}".format(args[1])
def onRequestFinish(self, *args):
api, req, err = args[:3]
cod = err.getErrorCode()
print "request {} finished".format(req.toString())
print cod == MegaRequest.TYPE_LOGIN
if cod == MegaError.API_OK:
if cod == MegaRequest.TYPE_LOGIN:
print "ama"
api.logout()
if cod != MegaError.API_OK or req.getType == MegaRequest.TYPE_LOGOUT:
print "an error occurs: {}".format(err.tostring())
print "ici"
self.v[0] = 0
if __name__ == "__main__":
v = [1]
api = MegaApi("myappkey")
li = Listner(v, api)
api.addListener(li)
api.login("myemail", "mypassword")
while v[0]:
time.sleep(0.5)
print v[0]
print "ended"
but I have noticed that "print cod == MegaRequest.TYPE_LOGIN" return true
when sending a "logout" command I think it should be MegaRequest.TYPE_LOGOUT no "MegaRequest.TYPE_LOGIN"
The text was updated successfully, but these errors were encountered:
Thank you for using our SDK!
It seems that you are comparing the error code (cod = err.getErrorCode()) with the request type (MegaRequest.TYPE_LOGIN). You should use req.getType() to know the request type.
Hello I try to learn mega at this moment
so I did a little prog:
but I have noticed that "print cod == MegaRequest.TYPE_LOGIN" return true
when sending a "logout" command I think it should be MegaRequest.TYPE_LOGOUT no "MegaRequest.TYPE_LOGIN"
The text was updated successfully, but these errors were encountered: