uitdatabank.shortcuts module

class uitdatabank.shortcuts.Shortcuts(path_to_settings_file, test)

Bases: uitdatabank.uitdatabank.UiTdatabank

find_upcoming_events_by_organiser_label Finds upcoming events that are organised by a specific organization
find_upcoming_events_by_city_name Finds upcoming events that are organised in a specific location

The Shortcuts class offers a number of probably frequently queries to the UiTdatabank. A full typology of queries is being thought up, so for now there are only limited shortcuts available. Feel free to help thinking about a topology: https://github.com/ruettet/uitdatabank/issues/2

Parameters:
  • path_to_settings_file – a file in which the settings, such as oauth credentials and api url, are made explicit
  • test – a boolean that can be set to True (default: False) so that only a limited amount of results is returned for test purposes
Returns:

an UiTdatabank wrapper that can be used to query the database, whose results will be returned as an SearchResults object

As an example, you could look for upcoming events in Brussels as follows:

>>> udb_shortcuts = Shortcuts("settings.cfg")
>>> upcoming_events_in_brussels = udb_shortcuts.find_upcoming_events_by_city_name("Brussel")
>>> for event in upcoming_events_in_brussels.get_events():
...   print(event)

# TODO to make this class a subclass of UiTdatabank is probably not the best design, I am still thinking about a better solution. Feel free to suggest a better design: https://github.com/ruettet/uitdatabank/issues/3

find_upcoming_events_by_city_name(city_name)

Finds upcoming events that are organised in a specific location

Parameters:city_name – Name of community where event takes place
Returns:SearchResults object
>>> udb_shortcuts = Shortcuts("settings.cfg")
>>> upcoming_events_in_bxl = udb_shortcuts.find_upcoming_events_by_organiser_label("Brussel")
>>> for event in upcoming_events_in_bxl.get_events():
...   print(event)
find_upcoming_events_by_organiser_label(organiser_label)

Finds upcoming events that are organised by a specific organization

Parameters:organiser_label – The full text label for an organization
Returns:SearchResults object
>>> udb_shortcuts = Shortcuts("settings.cfg")
>>> upcoming_events_in_flagey = udb_shortcuts.find_upcoming_events_by_organiser_label("Flagey")
>>> for event in upcoming_events_in_flagey.get_events():
...   print(event)