mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
18 lines
518 B
Python
18 lines
518 B
Python
import os
|
|
import requests
|
|
|
|
|
|
def pytest_configure(config):
|
|
if not getattr(config.option, "check_links", False):
|
|
return
|
|
|
|
timeout = float(os.environ.get("CHECK_LINKS_TIMEOUT", "10"))
|
|
original_request = requests.sessions.Session.request
|
|
|
|
def request_with_timeout(self, method, url, **kwargs):
|
|
if kwargs.get("timeout") is None:
|
|
kwargs["timeout"] = timeout
|
|
return original_request(self, method, url, **kwargs)
|
|
|
|
requests.sessions.Session.request = request_with_timeout
|