From 8829d9ce02f7972b4f6a628732d03ff97c5ee187 Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Mon, 6 May 2024 23:52:38 +0200 Subject: [PATCH] http: header: add default `User-Agent` header As customary with API libraries, it is useful for server operators to know which library makes requests to it. This sets the default to the library + version. Signed-off-by: Frank Villaro-Dixon --- overpy/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/overpy/__init__.py b/overpy/__init__.py index 6cc4a5b..3725142 100644 --- a/overpy/__init__.py +++ b/overpy/__init__.py @@ -75,7 +75,9 @@ class Overpass: #: Default URL of the Overpass server default_url: ClassVar[str] = "http://overpass-api.de/api/interpreter" - default_headers: ClassVar[Dict[str, str]] = {} + default_headers: ClassVar[Dict[str, str]] = { + 'User-Agent': 'python-overpy/{} (urllib)'.format(__version__), + } def __init__( self,