nokey.calendar package

Submodules

nokey.calendar.nager_date module

class nokey.calendar.nager_date.NagerDate(use_caching=False, cache_name='nager_date_cache', backend='sqlite', expire_after=3600)[source]

Bases: object

A class to interact with the Nager.Date API.

base_url

The base URL of the API.

about

A short description of the API.

get_available_countries()[source]

Returns all the countries available in the API.

Parameters:

None

Returns:

A list containing all the countries available in the API.

Return type:

list

get_country_info(countryCode)[source]

Returns information about a given country.

Parameters:

countryCode (str) – The code representing one of over a hundred countries supported by the API.

Returns:

A dictionary containing information about the given country.

Return type:

dict

get_docs_url()[source]

Returns the URL for the Nager.Date API documentation.

Parameters:

None

Returns:

The URL for the API docs.

Return type:

string

get_long_weekends_by_country(year, countryCode)[source]

Returns a list of long weekends for a given country in a given year.

Parameters:
  • year (int) – The year in question.

  • countryCode (str) – The code representing one of over a hundred countries supported by the API.

Returns:

A list containing the long weekends for a given country in a given year.

Return type:

list

get_public_holdiays_for_next_365(countryCode)[source]

Returns a list of the upcoming public holidays for a given country for the next 365 days.

Parameters:

countryCode (str) – The code representing one of over a hundred countries supported by the API.

Returns:

A list containing the upcoming public holidays for a given country for the next 365 days.

Return type:

list

get_public_holidays(year, countryCode)[source]

Returns a list of public holidays for a given country in a given year.

Parameters:
  • year (int) – The year in question.

  • countryCode (str) – The code representing one of over a hundred countries supported by the API.

Returns:

A list containing the public holidays for a given country in a given year.

Return type:

list

get_public_holidays_worldwide_for_next_7()[source]

Returns a list of all the public holidays worldwide for the next 7 days.

Parameters:

None

Returns:

A list containing all the upcoming public holidays worldwide for the next 7 days.

Return type:

list

is_today_a_public_holiday(countryCode, utc_offset=0)[source]

Returns True if today (UTC time zone) is a public holiday for a given country or False if it is not.

Parameters:
  • countryCode (str) – The code representing one of over a hundred countries supported by the API.

  • utc_offset (int) – Integer offset from UTC time zone to adjust for one’s own time zone.

Returns:

True if today (UTC time zone) is a public holiday for the given country or False if it is not.

Return type:

bool

Module contents