MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _create_http_session

Function _create_http_session

agents/reading-agent/main.py:548–568  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

546
547def _create_http_session() -> requests.Session:
548 session = requests.Session()
549 session.trust_env = True
550
551 if Retry is not None and HTTP_RETRY_TOTAL > 0:
552 retry = Retry(
553 total=HTTP_RETRY_TOTAL,
554 connect=HTTP_RETRY_TOTAL,
555 read=HTTP_RETRY_TOTAL,
556 status=HTTP_RETRY_TOTAL,
557 backoff_factor=HTTP_RETRY_BACKOFF,
558 allowed_methods=frozenset({"GET", "HEAD"}),
559 status_forcelist=(408, 425, 429, 500, 502, 503, 504, 520, 521, 522, 524),
560 respect_retry_after_header=True,
561 raise_on_status=False,
562 )
563 adapter = HTTPAdapter(max_retries=retry)
564 session.mount("http://", adapter)
565 session.mount("https://", adapter)
566
567 return session
568
569
570def _http_get(
571 url: str,

Callers 1

_http_getFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected