Python package for Canadian holidays
Project description
canada-holiday
a Python package for retrieving Canadian holidays information for all provinces for any given year.
Installation
With pip:
pip install canada-holiday
With poetry:
poetry add canada-holiday
Usage
import datetime
import canada_holiday
on_holidays_2023 = canada_holiday.get_holidays("Ontario", 2023)
# prints "Getting holiday information of Ontario province..."
print(on_holidays_2023)
# [CanadaHoliday(New Year's Day, 2023-01-01, Sunday, all), CanadaHoliday(Family Day, 2023-02-20, Monday, Ontario), ...]
manitoba_holidays_2023_june = canada_holiday.get_holidays("MB", 2023, 2)
# prints "Getting holiday information of Manitoba province..."
print(manitoba_holidays_2023_june)
# [CanadaHoliday(Louis Riel Day, 2023-02-20, Monday, Manitoba)]
louis_riel_day = manitoba_holidays_2023_june[0]
print(louis_riel_day.name)
# Louis Riel Day
print(louis_riel_day.month)
# 2
print(louis_riel_day.day)
# 20
print(louis_riel_day.date)
# 2023-02-20
print(louis_riel_day.province)
# Manitoba
print(louis_riel_day.day_of_the_week)
# Monday
date = datetime.date(2023, 8, 7)
result = canada_holiday.is_holiday(date, "British Columbia")
# prints "2023-08-07 is a holiday, B.C. Day in British Columbia province(s) in Canada"
print(result)
# True
date = datetime.date(2023, 4, 5)
result = canada_holiday.is_holiday(date, "Nova Scotia")
# prints "2023-04-05 is not a holiday in Nova Scotia province."
print(result)
# False
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
canada_holiday-1.1.4.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file canada_holiday-1.1.4.tar.gz
.
File metadata
- Download URL: canada_holiday-1.1.4.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41cfa9d2ca7e50704bc749dc1dffbef55a5395273928ef0355e652ddb3889382 |
|
MD5 | ec8e6d9e81093e182a551362bc9e7ad5 |
|
BLAKE2b-256 | 22dd067ce5cc59a79ed9c07658d1f69b087e73e27ce6997473b4a4e8ffeb2b5d |
File details
Details for the file canada_holiday-1.1.4-py3-none-any.whl
.
File metadata
- Download URL: canada_holiday-1.1.4-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/23.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1764da003b0243fa168e8cb21d6ed6c1b5ffcd513dd15f3f5835ea0e0b7aab4 |
|
MD5 | a2c147810009239ec40b6bcd9e0106cc |
|
BLAKE2b-256 | b6eb1f522cdb78b681561e9fda11529f5e1aa038580af7ebf7b7c6a4d5fd4392 |