(self, url_name, payload, is_changer=False, method='post', custom_headers=None)
| 1937 | } |
| 1938 | |
| 1939 | def cloudRequest(self, url_name, payload, is_changer=False, method='post', custom_headers=None): |
| 1940 | self.init_cloud_urls() |
| 1941 | url = self.cloudDiskUrls.get(url_name) |
| 1942 | if not url: |
| 1943 | self.log(f"云盘无效的URL名称: {url_name}") |
| 1944 | return {'result': None, 'headers': None} |
| 1945 | headers = { |
| 1946 | 'User-Agent': "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 unicom{version:iphone_c@12.0301}", |
| 1947 | 'Connection': "Keep-Alive", |
| 1948 | 'Accept-Encoding': "gzip", |
| 1949 | } |
| 1950 | if custom_headers: |
| 1951 | headers.update(custom_headers) |
| 1952 | if url_name in ['dosign', 'userInfo', 'doPopUp', 'toFinish', 'taskDetail', 'taskRecords']: |
| 1953 | if not getattr(self.cloudDisk, 'userticket', None): |
| 1954 | self.log(f"云盘 [{{url_name}}] userticket 未获取") |
| 1955 | return {'result': None, 'headers': None} |
| 1956 | headers['ticket'] = self.cloudDisk.userticket |
| 1957 | headers['content-type'] = "application/json;charset=UTF-8" |
| 1958 | headers['partnersid'] = "1649" |
| 1959 | headers['origin'] = "https://m.jf.10010.com" |
| 1960 | if getattr(self.cloudDisk, 'jeaId', None): |
| 1961 | headers['Cookie'] = f"_jea_id={self.cloudDisk.jeaId};" |
| 1962 | if url_name in ['dosign', 'toFinish']: |
| 1963 | sig_headers = self.build_signature_headers_cloud() |
| 1964 | if sig_headers: |
| 1965 | headers.update(sig_headers) |
| 1966 | if is_changer: |
| 1967 | headers['clienttype'] = "yunpan_unicom_applet" |
| 1968 | headers['x-requested-with'] = "com.sinovatech.unicom.ui" |
| 1969 | if url_name == 'toFinish': |
| 1970 | headers['User-Agent'] = "Mozilla/5.0 (Linux; Android 12; Redmi K30 Pro Build/SKQ1.220303.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/131.0.6778.39 Mobile Safari/537.36/woapp LianTongYunPan/4.0.4 (Android 12)" |
| 1971 | headers['clienttype'] = "yunpan_android" |
| 1972 | headers['x-requested-with'] = "com.chinaunicom.bol.cloudapp" |
| 1973 | else: |
| 1974 | headers['clienttype'] = "yunpan_android" |
| 1975 | headers['x-requested-with'] = "com.sinovatech.unicom.ui" |
| 1976 | elif url_name == 'ai_query': |
| 1977 | model_id = payload.get('modelId', 1) |
| 1978 | headers.update({ |
| 1979 | 'accept': 'text/event-stream', |
| 1980 | 'X-YP-Access-Token': self.cloudDisk.userToken, |
| 1981 | 'X-YP-App-Version': '5.0.12', |
| 1982 | 'X-YP-Client-Id': '1001000035', |
| 1983 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 9; SM-N9810 Build/PQ3A.190705.11211540; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36/woapp LianTongYunPan/5.0.12 (Android 9)', |
| 1984 | 'Content-Type': 'application/json', |
| 1985 | 'Origin': 'https://panservice.mail.wo.cn', |
| 1986 | 'X-Requested-With': 'com.chinaunicom.bol.cloudapp', |
| 1987 | 'Referer': f"https://panservice.mail.wo.cn/h5/wocloud_ai/?modelType={model_id}&clientId=1001000035&touchpoint=300300010001&token={self.cloudDisk.userToken}", |
| 1988 | }) |
| 1989 | elif url_name == 'lottery_times': |
| 1990 | method = 'get' |
| 1991 | headers.update({ |
| 1992 | 'X-YP-Access-Token': self.cloudDisk.userToken, 'source-type': 'woapi', 'clientId': '1001000165', |
| 1993 | 'token': self.cloudDisk.userToken, 'X-YP-Client-Id': '1001000165', |
| 1994 | }) |
| 1995 | elif url_name == 'aiMoveFile': |
| 1996 | headers.update({ |
no test coverage detected