Skip to content

Commit

Permalink
Remove gfs_0p25 from endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhollmann committed Dec 31, 2021
1 parent 5af4977 commit 8f7c11c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "blueskyapi"
version = "0.1.0"
version = "0.1.1"
description = "Client for blueskyapi.io"
authors = ["blueskyapi.io <contact@blueskyapi.io>"]
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions src/blueskyapi/client.py
Expand Up @@ -79,7 +79,7 @@ def latest_forecast(
:param columns: Which variables to fetch (see `this page for available variables <https://blueskyapi.io/docs/data>`_).
"""
response = self._get(
"/forecasts/gfs_0p25/latest",
"/forecasts/latest",
params=dict(
lat=lat,
lon=lon,
Expand Down Expand Up @@ -110,7 +110,7 @@ def forecast_history(
:param columns: Which variables to fetch (see `this page for available variables <https://blueskyapi.io/docs/data>`_).
"""
response = self._get(
"/forecasts/gfs_0p25/history",
"/forecasts/history",
params=dict(
lat=lat,
lon=lon,
Expand Down
30 changes: 12 additions & 18 deletions tests/blueskyapi/client_test.py
Expand Up @@ -54,16 +54,14 @@ def describe_with_api_key():
@responses.activate
def when_valid():
client = blueskyapi.Client(api_key="the-key")
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5", api_key="the-key"
)
add_api_response("/forecasts/latest?lat=53.5&lon=13.5", api_key="the-key")
client.latest_forecast(53.5, 13.5)

@responses.activate
def when_invalid():
client = blueskyapi.Client(api_key="the-key")
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5",
"/forecasts/latest?lat=53.5&lon=13.5",
api_key="the-key",
result={"detail": "Invalid API key"},
status=401,
Expand All @@ -75,21 +73,21 @@ def when_invalid():
def describe_latest_forecast():
@responses.activate
def test_defaults(client):
add_api_response("/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5")
add_api_response("/forecasts/latest?lat=53.5&lon=13.5")
client.latest_forecast(53.5, 13.5)

def describe_forecast_distances():
@responses.activate
def with_array(client):
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5&forecast_distances=0,24"
"/forecasts/latest?lat=53.5&lon=13.5&forecast_distances=0,24"
)
client.latest_forecast(53.5, 13.5, forecast_distances=[0, 24])

@responses.activate
def with_string(client):
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5&forecast_distances=0,24"
"/forecasts/latest?lat=53.5&lon=13.5&forecast_distances=0,24"
)
client.latest_forecast(53.5, 13.5, forecast_distances="0,24")

Expand All @@ -101,16 +99,12 @@ def with_invalid_value(client):
def describe_columns():
@responses.activate
def with_array(client):
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5&columns=col_a,col_b"
)
add_api_response("/forecasts/latest?lat=53.5&lon=13.5&columns=col_a,col_b")
client.latest_forecast(53.5, 13.5, columns=["col_a", "col_b"])

@responses.activate
def with_string(client):
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5&columns=col_a,col_b"
)
add_api_response("/forecasts/latest?lat=53.5&lon=13.5&columns=col_a,col_b")
client.latest_forecast(53.5, 13.5, columns="col_a,col_b")

@responses.activate
Expand All @@ -121,7 +115,7 @@ def with_invalid_value(client):
@responses.activate
def test_over_rate_limit(client):
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5",
"/forecasts/latest?lat=53.5&lon=13.5",
result={"the": "error"},
status=429,
)
Expand All @@ -131,7 +125,7 @@ def test_over_rate_limit(client):
@responses.activate
def test_result(client):
add_api_response(
"/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5",
"/forecasts/latest?lat=53.5&lon=13.5",
result=[{"forecast_moment": "2021-12-27T18:00:00Z", "some_column": 5}],
)
result = client.latest_forecast(53.5, 13.5)
Expand Down Expand Up @@ -165,7 +159,7 @@ def describe_min_forecast_moments():
@responses.activate
def with_datetime(client):
add_api_response(
"/forecasts/gfs_0p25/history"
"/forecasts/history"
"?lat=53.5&lon=13.5"
"&min_forecast_moment=2021-12-27T18:00:00"
"&max_forecast_moment=2021-12-28T00:00:00"
Expand All @@ -180,7 +174,7 @@ def with_datetime(client):
@responses.activate
def with_string(client):
add_api_response(
"/forecasts/gfs_0p25/history"
"/forecasts/history"
"?lat=53.5&lon=13.5"
"&min_forecast_moment=2021-12-27T18:00:00"
"&max_forecast_moment=2021-12-28T00:00:00"
Expand All @@ -201,7 +195,7 @@ def describe_max_forecast_moments():
@responses.activate
def with_none(client):
add_api_response(
"/forecasts/gfs_0p25/history"
"/forecasts/history"
"?lat=53.5&lon=13.5"
"&min_forecast_moment=2021-12-27T18:00:00"
)
Expand Down
Expand Up @@ -11,7 +11,7 @@ interactions:
User-Agent:
- python-requests/2.26.0
method: GET
uri: https://api.blueskyapi.io/forecasts/gfs_0p25/latest?lat=53.5&lon=13.5
uri: https://api.blueskyapi.io/forecasts/latest?lat=53.5&lon=13.5
response:
body:
string: !!binary |
Expand Down

0 comments on commit 8f7c11c

Please sign in to comment.