/libtad-python

Python library for accessing Time and Date APIs https://pypi.org/project/libtad/

Primary LanguagePythonMIT LicenseMIT

Time And Date Python API

pypi

Use our API Services to tap into timeanddate.com's databases and integrate our data into your applications

Service Reference

Requirements

  • Python 3.6

Installation

pip3 install libtad

Usage

from libtad import AstronomyService
from libtad.datatypes.places import Coordinates, LocationId
from libtad.datatypes.time import TADDateTime
from libtad.datatypes.astro import AstronomyEventClass, AstronomyObjectType

# Specify the location, and the dates you are querying for
coordinates = Coordinates(59.743, 10.204)
place = LocationId(coordinates)
date = TADDateTime(2020, 11, 26)

# To perform the query, you will need your access key and secret key
service = AstronomyService("accessKey", "secretKey")

# Select which astronomical events you are interested in
service.types = AstronomyEventClass.Meridian | AstronomyEventClass.Phase

# Retrieve astronomical information for specified astronomy object at a given time and place
astro_info = service.get_astronomical_info(AstronomyObjectType.Moon, place, date)

Credits

TadApi is owned and maintained by the Time and Date AS. You can visit our API Reference at timeanddate.com for project updates and releases.

Author

Time and Date