Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.13.5 SSL Certificate Errors #638

Open
pondscum1997 opened this issue Apr 9, 2024 · 7 comments
Open

1.13.5 SSL Certificate Errors #638

pondscum1997 opened this issue Apr 9, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@pondscum1997
Copy link

Upon updating to 1.13.5, I started receiving SSL certificate errors. I rolled back to 1.13.4 and the error went away. I see there were changes made to SSL and HTTPS in the new version. Error printout below

Traceback (most recent call last):

  File D:\anaconda\Lib\site-packages\urllib3\connectionpool.py:715 in urlopen
    httplib_response = self._make_request(

  File D:\anaconda\Lib\site-packages\urllib3\connectionpool.py:404 in _make_request
    self._validate_conn(conn)

  File D:\anaconda\Lib\site-packages\urllib3\connectionpool.py:1058 in _validate_conn
    conn.connect()

  File D:\anaconda\Lib\site-packages\urllib3\connection.py:419 in connect
    self.sock = ssl_wrap_socket(

  File D:\anaconda\Lib\site-packages\urllib3\util\ssl_.py:449 in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(

  File D:\anaconda\Lib\site-packages\urllib3\util\ssl_.py:493 in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)

  File D:\anaconda\Lib\ssl.py:517 in wrap_socket
    return self.sslsocket_class._create(

  File D:\anaconda\Lib\ssl.py:1108 in _create
    self.do_handshake()

  File D:\anaconda\Lib\ssl.py:1383 in do_handshake
    self._sslobj.do_handshake()

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1006)
@pondscum1997 pondscum1997 added the bug Something isn't working label Apr 9, 2024
@justinpolygon
Copy link
Contributor

Thanks for reporting @pondscum1997. I'll see if I can reproduce. Looks like you're on a Windows machine -- can you give me the version? I'll try to test it.

@justinpolygon justinpolygon self-assigned this Apr 9, 2024
@pondscum1997
Copy link
Author

Thanks for reporting @pondscum1997. I'll see if I can reproduce. Looks like you're on a Windows machine -- can you give me the version? I'll try to test it.

I apologize in advance for not being the most up to date user, I'm running Microsoft Windows 10 Education Version 10.0.19045 Build 19045. I noticed I was running this on Spyder 5.4.3, just updated to 5.5.1 and its the same.

  • Spyder version: 5.5.1 (conda)
  • Python version: 3.11.7 64-bit
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.10
  • Operating System: Windows-10-10.0.19045-SP0

@justinpolygon
Copy link
Contributor

Ah, no need to apologize. I just wanted to make sure I was running something close enough to debug it. You're all good. Thanks for getting back to me. I'll check it out.

@justinpolygon
Copy link
Contributor

justinpolygon commented Apr 10, 2024

Hey @pondscum1997, I'm still checking this out and cannot reproduce it.

Do you mind updating your urllib3 and certifi libraries? Probably with something like:

pip install -U urllib3
pip install -U certifi

Maybe you could try adding some additional code around the API call to see if we can see what cert it is complaining about.

try:
    # Your code that triggers the SSL error
except ssl.SSLCertVerificationError as e:
    logger.error(f"SSL certificate verification failed: {e}")
    # You can add more detailed logging here, such as:
    logger.debug(f"Certificate verify failed due to: {e.reason}. Verification process: {e.verify_code}")

Was is just happening on a simple rest API call? Sorry, I know it's a pain to install the other version and test. I just wanted to try and figure out what the root cause is here.

@pondscum1997
Copy link
Author

Sorry for the delay, everything was updated and still the same fault. I was running something similar to this.

from polygon import RESTClient
from polygon.rest import models

client = RESTClient()

aggs = client.get_aggs(
    "AAPL",
    1,
    "day",
    "2022-04-04",
    "2022-04-04",
)
print(aggs)

Again, this works on 1.13.4 but not 1.13.5. It also isn't logging the error like I want it to, so I'll get back to you on that once I figure that part out.

@justinpolygon
Copy link
Contributor

Okay, thanks for your help here @pondscum1997. I really appreciate the help. Does this happen to be a work computer or anything where you might have security software installed? I'm just wondering if there is an ssl proxy or something. Or, is it just a normal desktop system?

@pondscum1997
Copy link
Author

@justinpolygon This is a regular at home desktop. I'm going to install OpenSSL to try and troubleshoot better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants