guest

This module provides objects used to retrieve guests, guest information and guest details from a copy of the Wait Wait Don’t Tell Me! Stats database.

Guest

class wwdtm.guest.Guest(connect_dict=None, database_connection=None)

This class contains functions used to retrieve guest data from a copy of the Wait Wait Stats database.

Parameters
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

retrieve_all()

Returns a list of dictionary objects containing guest ID, name and slug string for all guests.

Return type

List[Dict[str, Any]]

Returns

List of all guests and their corresponding information. If guests could not be retrieved, an empty list is returned.

retrieve_all_details()

Returns a list of dictionary objects containing guest ID, name, slug string and appearance information for all guests.

Return type

List[Dict[str, Any]]

Returns

List of all guests and their corresponding information and appearances. If guests could not be retrieved, an empty list is returned.

retrieve_all_ids()

Returns a list of all guest IDs from the database, sorted by guest name.

Return type

List[int]

Returns

List of all guest IDs. If guest IDs could not be retrieved, an emtpy list is returned.

retrieve_all_slugs()

Returns a list of all guest slug strings from the database, sorted by guest name.

Return type

List[str]

Returns

List of all guest slug strings. If guest slug strings could not be retrieved, an emtpy list is returned.

retrieve_by_id(guest_id)

Returns a dictionary object containing guest ID, name and slug string for the requested guest ID.

Parameters

guest_id (int) – Guest ID

Return type

Dict[str, Any]

Returns

Dictionary containing guest information. If guest information could not be retrieved, an empty dictionary is returned.

retrieve_by_slug(guest_slug)

Returns a dictionary object containing guest ID, name and slug string for the requested guest slug string.

Parameters

guest_slug (str) – Guest slug string

Return type

Dict[str, Any]

Returns

Dictionary containing guest information. If guest information could not be retrieved, an empty dictionary is returned.

retrieve_details_by_id(guest_id)

Returns a dictionary object containing guest ID, name, slug string and appearance information for the requested Guest ID.

Parameters

guest_id (int) – Guest ID

Return type

Dict[str, Any]

Returns

Dictionary containing guest information and their appearances. If guest information could not be retrieved, an empty dictionary is returned.

retrieve_details_by_slug(guest_slug)

Returns a dictionary object containing guest ID, name, slug string and appearance information for the requested Guest slug string.

Parameters

guest_slug (str) – Guest slug string

Return type

Dict[str, Any]

Returns

Dictionary containing guest information and their appearances. If guest information could not be retrieved, an empty dictionary is returned.

GuestAppearances

class wwdtm.guest.GuestAppearances(connect_dict=None, database_connection=None)

This class contains functions that retrieve guest appearance information from a copy of the Wait Wait Stats database.

Parameters
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

retrieve_appearances_by_id(guest_id)

Returns a list of dictionary objects containing appearance information for the requested guest ID.

Parameters

guest_id (int) – Guest ID

Return type

Dict[str, Any]

Returns

Dictionary containing appearance counts and list of appearances for a guest. If guest appearances could not be retrieved, an empty dictionary is returned.

retrieve_appearances_by_slug(guest_slug)

Returns a list of dictionary objects containing appearance information for the requested guest slug string.

Parameters

guest_slug (str) – Guest slug string

Return type

Dict[str, Any]

Returns

Dictionary containing appearance counts and list of appearances for a guest. If guest appearances could not be retrieved, empty dictionary is returned.

GuestUtility

class wwdtm.guest.GuestUtility(connect_dict=None, database_connection=None)

This class contains supporting functions used to check whether a Guest ID or slug string exists or to convert an ID to a slug string, or vice versa.

Parameters
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

convert_id_to_slug(guest_id)

Converts a guest’s ID to the matching guest slug string.

Parameters

guest_id (int) – Guest ID

Return type

Optional[str]

Returns

Guest slug string, if a match is found

convert_slug_to_id(guest_slug)

Converts a guest’s slug string to the matching guest ID, if a match is found. If no match is found, None is returned.

Parameters

guest_slug (str) – Guest slug string

Return type

Optional[int]

Returns

Guest ID, if a match is found

id_exists(guest_id)

Checks to see if a guest ID exists.

Parameters

guest_id (int) – Guest ID

Return type

bool

Returns

True or False, based on whether the guest ID exists

slug_exists(guest_slug)

Checks to see if a guest slug string exists.

Parameters

guest_slug (str) – Guest slug string

Return type

bool

Returns

True or False, based on whether the guest slug string exists