leapseconds is a Python library with data on official leap seconds, provided as a tuple of Unix timestamps.
Source data: https://www.ietf.org/timezones/data/leap-seconds.list
pip install leapseconds
from leapseconds import LEAP_SECONDS
# Check if a Unix timestamp represents an officially announced leap second:
if 63072000 in LEAP_SECONDS:
print("True")
LEAP_SECONDS
:- A
tuple
of Unix timestamps (int
) that represent officially announced leap seconds in chronological order.
- A
leapseconds
is distributed under the terms of the MIT license.