MCPcopy
hub / github.com/alexandreborges/malwoverview / create_session

Function create_session

malwoverview/utils/session.py:26–48  ·  view source on GitHub ↗
(headers=None)

Source from the content-addressed store, hash-verified

24
25
26def create_session(headers=None):
27 session = requests.Session()
28
29 retry_strategy = Retry(
30 total=3,
31 backoff_factor=1,
32 status_forcelist=[500, 502, 503, 504],
33 allowed_methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS"],
34 )
35
36 adapter = HTTPAdapter(max_retries=retry_strategy)
37 session.mount("https://", adapter)
38 session.mount("http://", adapter)
39
40 if cv.proxy:
41 session.proxies = {"http": cv.proxy, "https": cv.proxy}
42
43 session.hooks['response'].append(_rate_limit_hook)
44
45 if headers:
46 session.headers.update(headers)
47
48 return session

Callers 15

_raw_vt_callMethod · 0.90
_raw_vc_callMethod · 0.90
_dispatch_formattedMethod · 0.90
_bazaar_queryMethod · 0.90
_urlhaus_hash_queryMethod · 0.90
_urlhaus_url_queryMethod · 0.90
_urlhaus_tag_queryMethod · 0.90
_triage_search_queryMethod · 0.90
_triage_dynamic_queryMethod · 0.90
_triage_batch_scanMethod · 0.90
_triage_dir_scanMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected