diff options
author | Aki <please@ignore.pl> | 2022-10-02 23:59:14 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-10-02 23:59:14 +0200 |
commit | 21c64c5f6c87fda8fbfbb34d8d625aa506b96046 (patch) | |
tree | b4b6ee4aea2e1169d64e9d4f50f0b1f8b3310eed | |
parent | 2828c3dd9487ba3f0de32a7dbe57d15701f08ad0 (diff) | |
download | windy-21c64c5f6c87fda8fbfbb34d8d625aa506b96046.zip windy-21c64c5f6c87fda8fbfbb34d8d625aa506b96046.tar.gz windy-21c64c5f6c87fda8fbfbb34d8d625aa506b96046.tar.bz2 |
Tweaked request interface a bit
I'm still not happy with it, but I think I just need to roll a dice once or
twice more, and then just settle on the outcome, because there is no point
wasting much more time on such a trivial module as this one.
-rw-r--r-- | windy/point_forecast.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/windy/point_forecast.py b/windy/point_forecast.py index 750ec00..83c328d 100644 --- a/windy/point_forecast.py +++ b/windy/point_forecast.py @@ -48,7 +48,7 @@ class Request: endpoint: str = "/point-forecast/v2" api: str = "https://api.windy.com/api" - def json(self): + def body(self): body = { 'key': self.key, 'lat': self.lat, @@ -60,6 +60,9 @@ class Request: body['levels'] = [str(x) for x in self.levels] return body + def url(self): + return self.api + self.endpoint + def point_forecast(request: Request): - return requests.post(request.api + request.endpoint, json=request.json()) + return requests.post(request.url(), json=request.body()) |