nstrydom2 / anonfile-api

An unofficial Python Anonfiles.com API
MIT License
62 stars 24 forks source link

unsupported operand type(s) for -=: 'tuple' and 'int' #71

Closed notBradPitt closed 1 year ago

notBradPitt commented 1 year ago

I'm getting an error unsupported operand type(s) for -=: 'tuple' and 'int' recently. Seems like it's caused by SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091) and it's trying to retry the connection or something

nstrydom2 commented 1 year ago

Thank you for bringing this issue to my attention. I was able to recreate the bug, and I am currently working on a fix.

nstrydom2 commented 1 year ago

Sorry about the late response. Yes, this actually may be intended functionality. This is a server side error, and Anonfiles.com outline why here. Hope this helps!

notBradPitt commented 1 year ago

Sorry about the late response. Yes, this actually may be intended functionality. This is a server side error, and Anonfiles.com outline why here. Hope this helps!

No worries, thanks for checking! IIRC I got the same SSL certificate error while trying to download AnonFiles links directly using curl or wget, but was able to fix it by using --no-check-certificate. Could adding an option to disable SSL check work as temporary workaround?

hentai-chan commented 1 year ago

Sorry about the late response. Yes, this actually may be intended functionality. This is a server side error, and Anonfiles.com outline why here. Hope this helps!

No worries, thanks for checking! IIRC I got the same SSL certificate error while trying to download AnonFiles links directly using curl or wget, but was able to fix it by using --no-check-certificate. Could adding an option to disable SSL check work as temporary workaround?

Yes this should be relatively easy to implement, just add a self.__get(args, verify=self.verify) in the preview, download and upload methods whilst introducing a self.verify=True parameter to the AnonFile class in the constructor (set to True to maintain backwards compatibility but also for security reasons, this option really should stay turned on if possible). Since self.__get() already takes **kwargs as a parameter this overload has already been taking care of. @nstrydom2 pinging you since you wanted to work on this.