From 62002baeed9809bcfdf490491b0889c0086006b0 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:40:05 -0500 Subject: [PATCH] fix: Set a User-Agent header on all requests readthedocs/readthedocs.org#11763 --- docs/changelog.rst | 5 +++++ docs/conf.py | 2 +- ocdsextensionregistry/util.py | 3 +++ pyproject.toml | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index faeb4f9..3988aff 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Changelog ========= +0.5.5 (2024-11-25) +------------------ + +- Set a User-Agent header on all requests. + 0.5.4 (2024-10-27) ------------------ diff --git a/docs/conf.py b/docs/conf.py index e5dd6ec..1dd45bf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,7 +23,7 @@ author = "Open Contracting Partnership" # The short X.Y version -version = "0.5.4" +version = "0.5.5" # The full version, including alpha/beta/rc tags release = version diff --git a/ocdsextensionregistry/util.py b/ocdsextensionregistry/util.py index 95137df..59cf427 100644 --- a/ocdsextensionregistry/util.py +++ b/ocdsextensionregistry/util.py @@ -27,6 +27,9 @@ # https://urllib3.readthedocs.io/en/latest/advanced-usage.html#customizing-pool-behavior adapter = HTTPAdapter(max_retries=3, pool_maxsize=int(os.getenv('REQUESTS_POOL_MAXSIZE', '10'))) session = CachedSession(backend='memory', expire_after=os.getenv('REQUESTS_CACHE_EXPIRE_AFTER', NEVER_EXPIRE)) +session.headers.update( + {'User-Agent': 'ocdsextensionregistry (+http://www.open-contracting.org; data@open-contracting.org)'} +) session.mount('https://', adapter) session.mount('http://', adapter) diff --git a/pyproject.toml b/pyproject.toml index 407539e..2a18490 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "ocdsextensionregistry" -version = "0.5.4" +version = "0.5.5" authors = [{name = "Open Contracting Partnership", email = "data@open-contracting.org"}] description = "Eases access to information from the extension registry of the Open Contracting Data Standard" readme = "README.rst"