zoukankan      html  css  js  c++  java
  • Python 体赛websocket反爬破解

    #体赛反爬破解

    import json, time
    import websocket
    import ssl
    
    
    #https://www.tisai.com/
    class OTC:
        url = 'wss://push.tisai.com:37272/'
        #定义好请求的数据
        data_info = {"type":"football","is_pc":"1"}
        def get_web_socket(self):
            while 1:
                try:
                    ws = websocket.create_connection(self.url,sslopt={"cert_reqs":ssl.CERT_NONE})
                    # ws.run_forever(sslopt={'cert_reqs': ssl.CERT_NONE})
                    # 发送消息
                    ws.send(json.dumps(self.data_info))
                    # 接收消息
                    data = ws.recv()
                    result = json.loads(data)
    
                    print(result)
                    print("-" * 200)
    
                    # 数据监测间隔
                    time.sleep(1)
    
                except Exception as e:
                    print('retry to connect...',e)
    
    otc = OTC()
    otc.get_web_socket()
  • 相关阅读:
    敏捷 咨询师 火星人陈勇博客牛人
    fpa 功能点分析法
    cto职责
    lexus
    c
    zz
    百度效率云
    zz
    产品研发体系中的需求承接与输出
    ESAPI学习笔记
  • 原文地址:https://www.cnblogs.com/HugJun/p/12060662.html
Copyright © 2011-2022 走看看