From 8c6bc6e8005a15987627806b58737a65c81c0dc0 Mon Sep 17 00:00:00 2001 From: gmulhearn-anonyome <90162009+gmulhearn-anonyome@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:50:26 +1000 Subject: [PATCH] Patch for document loader default User-Agent (#1) * adding user agent Signed-off-by: George Mulhearn * setting User-Agent a different way Signed-off-by: George Mulhearn --------- Signed-off-by: George Mulhearn --- aries_cloudagent/vc/ld_proofs/document_downloader.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aries_cloudagent/vc/ld_proofs/document_downloader.py b/aries_cloudagent/vc/ld_proofs/document_downloader.py index 19c64bbb97..a767c49f74 100644 --- a/aries_cloudagent/vc/ld_proofs/document_downloader.py +++ b/aries_cloudagent/vc/ld_proofs/document_downloader.py @@ -8,6 +8,7 @@ from typing import Dict, Optional import urllib.parse as urllib_parse from importlib import resources +from ...version import __version__ import requests from pyld import jsonld @@ -120,6 +121,7 @@ def download(self, url: str, options: Optional[Dict], **kwargs): headers = options.get("headers") if headers is None: headers = {"Accept": "application/ld+json, application/json"} + headers["User-Agent"] = f"AriesCloudAgent/{__version__}" response = requests.get(url, headers=headers, **kwargs) content_type = response.headers.get("content-type")