From 14ccf6de52b7fe8bd2f845e84811ccc024070d2e Mon Sep 17 00:00:00 2001 From: Klaas Schoute Date: Fri, 28 Jun 2024 22:27:07 +0200 Subject: [PATCH] Move version metadata to outside the ODPAmsterdam class (#682) * Move version metadata to outside the ODPAmsterdam class * Move version metadata to outside the ODPAmsterdam class --- src/odp_amsterdam/odp_amsterdam.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/odp_amsterdam/odp_amsterdam.py b/src/odp_amsterdam/odp_amsterdam.py index 931e39e..d7f6084 100644 --- a/src/odp_amsterdam/odp_amsterdam.py +++ b/src/odp_amsterdam/odp_amsterdam.py @@ -21,10 +21,12 @@ ) from .models import Garage, ParkingSpot +VERSION = metadata.version(__package__) + @dataclass class ODPAmsterdam: - """Main class for handling data fetchting from Open Data Platform of Amsterdam.""" + """Main class for handling data fetching from Open Data Platform of Amsterdam.""" request_timeout: float = 15.0 session: ClientSession | None = None @@ -59,14 +61,13 @@ async def _request( the Open Data Platform API of Amsterdam. """ - version = metadata.version(__package__) url = URL.build(scheme="https", host="api.data.amsterdam.nl", path="/").join( URL(uri), ) headers = { "Accept": "application/json, text/plain, application/geo+json", - "User-Agent": f"PythonODPAmsterdam/{version}", + "User-Agent": f"PythonODPAmsterdam/{VERSION}", } if self.session is None: