NagerObjectAPI
- class nagerapi.NagerObjectAPI(session: Optional[Session] = None, default_country: Optional[Union[str, Country]] = None)[source]
Main Object API Class
- Parameters:
session (Session) – Use your own Session object.
default_country (Union[str, Country]) – Default Country to use in any method where country isn’t provided.
- Variables:
name (str) – Name of the API.
version (int) – Version of the API.
default_country (Country) – Default Country to use.
- country(country: Optional[Union[str, Country]] = None, load=True)[source]
CountryObject with details.- Parameters:
country (Union[Country, str]) – ISO 3166-1 alpha-2 Country Code.
load (bool) – Load Full Details.
- Returns:
- Raises:
NagerException – When an Invalid Country Code is provided.
- long_weekends(year: int, country: Optional[Union[str, Country]] = None)[source]
All available
WeekendObjects for a country in a given year.- Parameters:
year (int) – Year to look at.
country (Union[Country, str]) – ISO 3166-1 alpha-2 Country Code.
- Returns:
List[
Weekend]- Raises:
NagerException – When an Invalid Country Code or year is provided.
- public_holidays(year: int, country: Optional[Union[str, Country]] = None)[source]
All available public
HolidayObjects for a country in a given year.- Parameters:
year (int) – Year to look at.
country (Union[Country, str]) – ISO 3166-1 alpha-2 Country Code.
- Returns:
List[
Holiday]- Raises:
NagerException – When an Invalid Country Code or year is provided.
- is_today_public_holiday(country: Optional[Union[str, Country]] = None, offset: Optional[int] = None)[source]
Is today a public Holiday for the given country.
- Parameters:
country (Union[Country, str]) – ISO 3166-1 alpha-2 Country Code.
offset (int) – UTC timezone offset.
- Returns:
bool
- Raises:
NagerException – When an Invalid Country Code is provided.
- next_public_holidays(country: Optional[Union[str, Country]] = None)[source]
Returns the upcoming public
HolidayObjects for the next 365 days for the given country.- Parameters:
country (Union[Country, str]) – ISO 3166-1 alpha-2 Country Code.
- Returns:
List[
Holiday]- Raises:
NagerException – When an Invalid Country Code is provided.
NagerRawAPI
- class nagerapi.NagerRawAPI(session: Optional[Session] = None)[source]
Main Raw API Class
- Parameters:
session (Session) – Use your own Session object.
- get_country_info(country: str)[source]
GET CountryInfo: Get country info for the given country.
- Parameters:
country (str) – ISO 3166-1 alpha-2 Country Code.
- Returns:
Dict
- Raises:
NagerException – When an Invalid Country Code or year is provided.
- get_available_countries()[source]
GET AvailableCountries: Get all available countries.
- Returns:
List[Dict]
- get_long_weekend(year: int, country: str)[source]
GET LongWeekend: Get long weekends for a given country
- Parameters:
year (int) – Year to look at.
country (str) – ISO 3166-1 alpha-2 Country Code.
- Returns:
List[Dict]
- Raises:
NagerException – When an Invalid Country Code or year is provided.
- get_public_holidays(year: int, country: str)[source]
GET PublicHolidays: Get public holidays.
- Parameters:
year (int) – Year to look at.
country (str) – ISO 3166-1 alpha-2 Country Code.
- Returns:
List[Dict]
- Raises:
NagerException – When an Invalid Country Code or year is provided.
- get_is_today_public_holiday(country: str, offset: Optional[int] = None)[source]
GET IsTodayPublicHoliday: Is today a public holiday.
- Parameters:
country (str) – ISO 3166-1 alpha-2 Country Code.
offset (int) – UTC timezone offset.
- Returns:
bool
- Raises:
NagerException – When an Invalid Country Code is provided.
- get_next_public_holidays(country: str)[source]
GET NextPublicHolidays: Returns the upcoming public holidays for the next 365 days for the given country.
- Parameters:
country (str) – ISO 3166-1 alpha-2 Country Code.
- Returns:
List[Dict]
- Raises:
NagerException – When an Invalid Country Code is provided.
- get_next_public_worldwide_holidays()[source]
GET NextPublicHolidaysWorldwide: Returns the upcoming public holidays for the next 7 days.
- Returns:
List[Dict]
- get_version()[source]
GET Version: Get version of the used Nager.Date library.
- Returns:
Dict