RichardJRL / pocketmagstopdf

Download pocketmags magazines in PDF format from the HTML5 reader
Creative Commons Zero v1.0 Universal
42 stars 8 forks source link

verification problems??? #10

Closed wizwardicuz closed 1 year ago

wizwardicuz commented 1 year ago

Fairly new to python and stuff, have used this in the past to download magazines just fine. Bought some new ones and ran into some issues, one of which was already described here due to problems with the "original" quality setting. I downloaded the newest version of the code and tried to get the extrahigh quality to work, but something is still going wrong. I've included the readout below:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/alexis/Downloads/pocketmagstopdf-main/pocketmagstopdf.py", line 757, in main() File "/Users/alexis/Downloads/pocketmagstopdf-main/pocketmagstopdf.py", line 361, in main with urlopen(page_url) as f: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

I do not have enough experience with coding to even begin to understand what this means. Thanks in advance for your help :)

lkowolowski commented 1 year ago

Looks like verification of the certificate failed. If there is an option to not verify, that would probably fix it. If not, sounds like a feature request 🙂

RichardJRL commented 1 year ago

I'm afraid I cannot replicate this with the information provided. Still stuck with the original quality problem as I haven't had the time to devote to researching it, but just testing again now with high and extrahigh quality I'm having no issues with my limited number of previously purchased magazines.

To further investigate your problem, can you try passing a plain http URL to the script instead of https? I've just checked and the pocketmags data sources don't redirect to https if you only use http for the initial query.

Looking at the traceback it looks like Python can't find an up-to-date set of SSL certs on your computer given that it says unable to get local issuer certificate. Try running pip install --upgrade certifi from the terminal...

What operating system are you using?

Edit: Also dropping this in here for reference, and in case you are using MacOS: https://github.com/Rapptz/discord.py/issues/423#issuecomment-272093801

wizwardicuz commented 1 year ago

Using http did make it work. I'm using MacOS and have upgraded certificates, tested it again and the issue appears to be resolved! Thank you! :D

RichardJRL commented 1 year ago

Glad it's resolved for you!