Obtaining a list of leap seconds
In order to obtain the current leap second list, you must use one of
LeapSecondData from_* class methods.
Using the first available standard source
If you do not have any particular restrictions on your Internet access,
you can try the “magic” method LeapSecondData.from_standard_source(),
which will try known local then network sources:
from leapseconddata import LeapSecondData
data = LeapSecondData.from_standard_source()
...
Using a custom file source
If you have a custom path for the leap-seconds.list the module can use,
you can use the LeapSecondData.from_file() method. For example,
if your file is located at /etc/my-program/leap-seconds.list:
from leapseconddata import LeapSecondData
data = LeapSecondData.from_file("/etc/my-program/leap-seconds.list")
Using a custom URL
If you have restrictions on your Internet access and can only access the
file from a specific URL available to your machine, you can use
LeapSecondData.from_url():
from leapseconddata import LeapSecondData
data = LeapSecondData.from_url("https://tz.example/leap-seconds.list")
You can also still try local sources before your custom URL, by using
LeapSecondData.from_standard_source() with the custom_sources
keyword parameter set:
from leapseconddata import LeapSecondData
data = LeapSecondData.from_standard_source(
custom_sources=["https://tz.example/leap-seconds.list"],
)