summaryrefslogtreecommitdiff
path: root/windy/point_forecast.py
diff options
context:
space:
mode:
Diffstat (limited to 'windy/point_forecast.py')
-rw-r--r--windy/point_forecast.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/windy/point_forecast.py b/windy/point_forecast.py
index 83c328d..976f785 100644
--- a/windy/point_forecast.py
+++ b/windy/point_forecast.py
@@ -1,8 +1,6 @@
from dataclasses import dataclass
from enum import Enum
-import requests
-
class _StrEnum(Enum):
def __str__(self):
@@ -45,8 +43,6 @@ class Request:
model: Model
parameters: list = None
levels: list = None
- endpoint: str = "/point-forecast/v2"
- api: str = "https://api.windy.com/api"
def body(self):
body = {
@@ -60,9 +56,10 @@ class Request:
body['levels'] = [str(x) for x in self.levels]
return body
- def url(self):
- return self.api + self.endpoint
+@dataclass
+class Endpoint:
+ path: str
-def point_forecast(request: Request):
- return requests.post(request.url(), json=request.body())
+ def __call__(self, windy, request: Request):
+ return windy.session.post(windy.api + self.path, json=request.body())