Created
July 20, 2018 13:15
-
-
Save timbirk/024a26c93aabbfadee802c7c5bb5bca1 to your computer and use it in GitHub Desktop.
Python script to detect if it's a UK bank holiday. Requires "holidays" pip package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import holidays | |
from datetime import date | |
sys.exit(date.today() not in holidays.England()) |
I've released a better version of this to PyPi as a package: https://pypi.org/project/publicholiday/
which handles all countries supported by: https://pypi.org/project/holidays/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many times I've needed to run or not run tasks (cron jobs, bank uploads / reports) with an awareness to bank holidays. A consultancy quoted a lot of money and 3 months to build a java service to do it... Python to the rescue!.