MCPcopy Create free account
hub / github.com/boy-hack/hack-requests / _cookie_update

Method _cookie_update

HackRequests/HackRequests.py:412–439  ·  view source on GitHub ↗

用于更新旧cookie,与新cookie得出交集后返回新的cookie :param old:旧cookie :param new:新cookie :return:Str:新cookie

(self, old, new)

Source from the content-addressed store, hash-verified

410 return text
411
412 def _cookie_update(self, old, new):
413 '''
414 用于更新旧cookie,与新cookie得出交集后返回新的cookie
415 :param old:旧cookie
416 :param new:新cookie
417 :return:Str:新cookie
418 '''
419 # 先将旧cookie转换为字典,再将新cookie转换为字典时覆盖旧cookie
420 old_sep = old.strip().split(";")
421 new_sep = new.strip().split(";")
422 cookie_dict = {}
423 for sep in old_sep:
424 if sep == "":
425 continue
426 try:
427 k, v = sep.split("=")
428 cookie_dict[k.strip()] = v
429 except:
430 continue
431 for sep in new_sep:
432 if sep == "":
433 continue
434 try:
435 k, v = sep.split("=")
436 cookie_dict[k.strip()] = v
437 except:
438 continue
439 return cookie_dict
440
441
442class threadpool:

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected