meteociel.forecasts.get_forecast_url

meteociel.forecasts.get_forecast_url(*, city_name: str = '', city_id: str = '', mode: str = 'forecasts', model: str = 'gfs')

Search and return the correct url to get the requested forecasts data.

See also

The parameters are the same as for the meteociel.forecasts.forecast function.

Parameters

city_namestr, keyword_only, optionnal

By default: "". The requested city name.

city_idstr, keyword_only, optionnal

By default: "". By passing directly the city id, the API will search by id rather than by name.

modestr, keyword_only, optionnal

By default: "forecasts". There is two available modes:

  • "forecasts" that provides data for the three days ahead;

  • "trends" that provides data for the ten days ahead but with lower confidence.

modelstr, keyword_only, optionnal

By default: "gfs". The model from which the data are obtained.

Note

The model parameter is only available in "forecasts" mode, otherwise it will ignored.

Returns

outstr

The url of the data.

Raises

ConnectionError

Can be raised if the request fails.

TooManyCitiesError

This exception is raised if the given city name match several cities.

Exemples

>>> from meteociel.forecasts import get_forecast_url
>>> url = get_forecast_url(city_name="Toulouse 31000", mode="forecasts", model="gfs")
>>> url
https://www.meteociel.fr/previsions/10979/toulouse.htm