zoukankan      html  css  js  c++  java
  • 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:Python37libsite-packageswebsocket\_core.py", line 595, in create_connection
        websock.connect(url, **options)
      File "C:Python37libsite-packageswebsocket\_core.py", line 252, in connect
        self.handshake_response = handshake(self.sock, *addrs, **options)
      File "C:Python37libsite-packageswebsocket\_handshake.py", line 59, in handshake
        status, resp = _get_resp_headers(sock)
      File "C:Python37libsite-packageswebsocket\_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()    
    如果觉得对您有帮助,麻烦您点一下推荐,谢谢!



    好记忆不如烂笔头
  • 相关阅读:
    Java Script 读书笔记 (二) 错误处理机制 -- 没看懂,待review
    Visual Studio Code Tips
    SQLServer数据库分页查询
    Sql server inner join......on
    Sql server if-else以及switch
    git介绍
    Fiddler
    cocos2d对动画的各种操作
    SQLI
    Windows系统命令备份
  • 原文地址:https://www.cnblogs.com/xuchunlin/p/14919106.html
Copyright © 2011-2022 走看看