why is my python script saying I have an ssl certificate error when all my certificates are up to date

Viewed 672

I'm trying to connect via websockets to a service called Alpaca, basically you subscribe to there server and they send stock data back through the websocket to your computer. Everything is running perfectly fine except when I try to run the software I get: ERROR:root:error while consuming ws messages: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997) I check and updated my certificates about 1000 times and that clearly does nothing. I ran the code on another laptop that has python on it and when I ran it on that machine everything went fine. Its really weird and I cannot figure it out for the life of me so any help would be fantastic. the code below is actually what I'm running except I don't have my api keys since those need to be kept a secret.

import alpaca_trade_api as tradeapi
import threading
conn = tradeapi.stream2.StreamConn('api_key','api_secret_key','https://paperapi.alpaca.markets')
@conn.on(r'^trade_updates$')
async def on_trade_updates(conn, channel, trade):
    print('trade', trade)def ws_start():conn.run(['account_updates', 'trade_updates'])
ws_thread = threading.Thread(target=ws_start, daemon=True)
ws_thread.start()
0 Answers
Related