首页 > 其他分享> > websocket._exceptions.WebSocketBadStatusException: Handshake status 429 Too Many Requests
websocket._exceptions.WebSocketBadStatusException: Handshake status 429 Too Many Requests
作者:互联网
Traceback (most recent call last): File "D:/spider_telegram/spider_17_deribit/spider_2_get_content.py", line 213, in <module> hour_spider(item) File "D:/spider_telegram/spider_17_deribit/spider_2_get_content.py", line 168, in hour_spider ws = websocket.create_connection(url=url, headers=headers) File "C:\Python37\lib\site-packages\websocket\_core.py", line 595, in create_connection websock.connect(url, **options) File "C:\Python37\lib\site-packages\websocket\_core.py", line 252, in connect self.handshake_response = handshake(self.sock, *addrs, **options) File "C:\Python37\lib\site-packages\websocket\_handshake.py", line 59, in handshake status, resp = _get_resp_headers(sock) File "C:\Python37\lib\site-packages\websocket\_handshake.py", line 145, in _get_resp_headers raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers) websocket._exceptions.WebSocketBadStatusException: Handshake status 429 Too Many Requests
查看代码,忘记关闭链接了,加上ws.close() 即可
url = 'wss://test.deribit.com/ws/api/v2' ws = websocket.create_connection(url=url, headers=headers) ws.send(json.dumps(msg)) response = ws.recv() # ws.close()
标签:status,Handshake,websocket,py,spider,headers,ws,line 来源: https://www.cnblogs.com/xuchunlin/p/14919106.html