Skip to content

Commit

Permalink
Move version metadata to outside the P1Monitor class (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasnicolaas authored Jun 28, 2024
1 parent 5c410d8 commit 3619f27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/p1monitor/p1monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from .exceptions import P1MonitorConnectionError, P1MonitorError, P1MonitorNoDataError
from .models import Phases, Settings, SmartMeter, WaterMeter

VERSION = metadata.version(__package__)


@dataclass
class P1Monitor:
Expand Down Expand Up @@ -53,11 +55,10 @@ async def _request(
P1MonitorError: Received an unexpected response from the P1 Monitor API.
"""
version = metadata.version(__package__)
url = URL.build(scheme="http", host=self.host, path="/api/").join(URL(uri))

headers = {
"User-Agent": f"PythonP1Monitor/{version}",
"User-Agent": f"PythonP1Monitor/{VERSION}",
"Accept": "application/json, text/plain, */*",
}

Expand Down

0 comments on commit 3619f27

Please sign in to comment.