You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
frompysurfline.api.servicesimportApiServicefrompysurfline.coreimportSpotForecastsclassSurflineClient:
"""surfline client Surfline API client. At the moment, does not require authentication. TODO: Login and authentication """_baseurl: str="https://services.surfline.com/kbyg/"defget_spot_forecasts(
self, spotId: str, intervalHours: int=None, days: int=None
) ->SpotForecasts:
"""create a SpotForecast object from API responses Arguments: spotId (str): spot id intervalHours (int, optional): interval hours. Defaults to None. days (int, optional): days. Defaults to None. Returns: SpotForecast: SpotForecast object """params= {}
params["spotId"] =spotId# add optional parametersifintervalHours:
params["intervalHours"] =intervalHoursifdays:
params["days"] =daysreturnSpotForecasts(
spotId,
# spot datails are integrated with forecast,# hence the different GET argsdetails=ApiService(self, "spots/details").get({"spotId": spotId}),
waves=ApiService(self, "spots/forecasts/wave").get(params=params),
winds=ApiService(self, "spots/forecasts/wind").get(params=params),
tides=ApiService(self, "spots/forecasts/tides").get(params=params),
# weather and sunlight times are in the same responseweather=ApiService(self, "spots/forecasts/weather").get(params=params)[0],
sunlightTimes=ApiService(self, "spots/forecasts/weather").get(
params=params
)[1],
)
The text was updated successfully, but these errors were encountered:
pysurfline/pysurfline/api/client.py
Line 11 in 90a981e
The text was updated successfully, but these errors were encountered: