MCPcopy
hub / github.com/smallfawn/QLScriptPublic / request

Method request

daily/chinaUnicom.py:507–528  ·  view source on GitHub ↗
(self, method, url, **kwargs)

Source from the content-addressed store, hash-verified

505 return False
506
507 def request(self, method, url, **kwargs):
508 try:
509 current_cookies = self.session.cookies.get_dict()
510 if self.cookie_string:
511 for item in self.cookie_string.split(';'):
512 if '=' in item:
513 k, v = item.split('=', 1)
514 current_cookies[k.strip()] = v.strip()
515 cookie_header = "; ".join([f"{k}={v}" for k, v in current_cookies.items()])
516 if cookie_header:
517 if 'headers' not in kwargs:
518 kwargs['headers'] = {}
519 kwargs['headers']['Cookie'] = cookie_header
520 timeout = kwargs.get('timeout', 10)
521 if 'timeout' in kwargs: del kwargs['timeout']
522 response = self.session.request(method, url, timeout=timeout, **kwargs)
523 if response.status_code >= 400:
524 self.log(f"请求 {url} 返回状态码 {response.status_code}")
525 return response
526 except Exception as e:
527 self.log(f"请求 {url} 异常: {str(e)}")
528 return None
529
530 def load_token_from_cache(self):
531 if not self.account_mobile:

Callers 15

queryRemainMethod · 0.95
onLineMethod · 0.95
gettaskipMethod · 0.95
sign_getContinuousMethod · 0.95
sign_daySignMethod · 0.95
sign_getTelephoneMethod · 0.95
sign_getTaskListMethod · 0.95
sign_doTaskFromListMethod · 0.95
sign_getTaskRewardMethod · 0.95
sign_grabCouponMethod · 0.95
sign_grab_executeMethod · 0.95
wocare_apiMethod · 0.95

Calls 2

logMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected