class China_Unicom: def init(self, phone_num, run_ua=None): self.phone_num = phone_num self.headers = { 'Host': '10010.woread.com.cn', 'Accept': 'application/json, text/plain, /', 'Accept-Language': 'zh-CN,zh-Hans;q=0.9', 'Accept-Encoding': 'gzip, deflate, br', 'Content-Type': 'application/json;charset=utf-8', 'Origin': 'https://10010.woread.com.cn', 'Connection': 'keep-alive', 'Referer': 'https://10010.woread.com.cn/ng_woread/', } if run_ua is None or run_ua == '': self.headers['User-Agent'] = f'Mozilla/5.0 (Linux; Android {randint(8, 13)}; SM-S908U Build/TP1A.220810.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/{randint(95, 108)}.0.5359.128 Mobile Safari/537.36; unicom{{version:android@9.0{randint(0,6)}00,desmobile:{self.phone_num}}};devicetype{{deviceBrand:,deviceModel:}};{{yw_code:}}' else: self.headers['User-Agent'] = run_ua

    self.fail_num = 0
    self.activeIndex = '26'
中国联通 Python 代码优化 - User-Agent 自动生成

原文地址: https://www.cveoy.top/t/topic/mBgb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录