geographic module

class shellbot.plugins.geographic.setup.Geographic(*args, **kwargs)

Utility plugin (weather, time, geographic information, …)

coroutine cityinfo(ctx, *, city, code=None)

Implement the cityinfo command.

Parameters:
  • ctx (Context) – The command context.
  • city (str) – The city name.
  • code (str [optional]) – City’s ISO-3166 code.
coroutine isocode(ctx, *, expr)

Implement the isocode command.

Parameters:
  • ctx (Context) – The command context.
  • expr (str) – Name constraint (e.g. first letters of country’s name).
Raise:

NotFound – No data can be fetched.

coroutine time(ctx, *, city=None, code=None)

Implement the time command.

Parameters:
  • ctx (Context) – The command context.
  • city (str [optional]) – Optional city name or local time.
  • code (str [optional]) – City’s ISO-3166 code.
coroutine weather(ctx, *, city, code=None)

Implement the weather command.

Parameters:
  • ctx (Context) – The command context.
  • city (str) – The city name.
  • code (str [optional]) – City’s ISO-3166 code.
Raise:

HTTPError

Geographic API module

class shellbot.plugins.geographic.lib.http.APIClient(geonames, timezonedb, openweathermap)

A Geoname API Client.

coroutine city_info(city, code=None)

Fetch a city info view for the given parameters.

coroutine coordinates(city, code=None)

Fetch geographic coordinates for the given parameters and return a pair consisting of the response and a formatted string describing the query.

Parameters:
  • city (str) – The city name.
  • code (str [optional]) – An ISO-3166 code for the city country name.
Raise:

NotFound – Empty response.

coroutine time_info(city, code=None)

Fetch a time info view for the given parameters.

coroutine weather_info(city, code=None)

Fetch a weather info view for the given parameters.

shellbot.plugins.geographic.lib.formatters.city_info(entry, query)

A city info view.

Parameters:
  • coords (GeonamesEntry) – A Geoname data.
  • query (str) – The query for this request.
shellbot.plugins.geographic.lib.formatters.weather_info(response)

An object containing weather data.