The Official Holiday and Event API for Python
![Funding Status](https://img.shields.io/github/sponsors/westy92)
Industry-leading Holiday and Event API for Python. Over 5,000 holidays and thousands of descriptions. Trusted by the World’s leading companies. Built by developers for developers since 2011.
Supported Python Versions
Latest version of the the Holiday and Event API supports all actively-maintained Python releases and might work with older versions. It also supports PyPy versions 3.7
, 3.8
, and 3.9
.
Authentication
Access to the Holiday and Event API requires an API Key. You can get for one for FREE here, no credit card required! Note that free plans are limited. To access more data and have more requests, a paid plan is required.
Installation
The Holiday and Event API is available on PyPI:
$ python -m pip install holiday-event-api
Example
import holidays
try:
client = holidays.client('<Your API Key Here>')
events = client.getEvents(
)
event = events.events[0]
print(f"Today is {event.name}! Find more information at: {event.url}.")
print(f"Rate limits remaining: {events.rateLimit.remainingMonth}/{events.rateLimit.limitMonth} (month).")
eventInfo = client.getEventInfo(
id=event.id,
)
print(f"The Event's hashtags are {eventInfo.event.hashtags}.")
query = "pizza day"
search = client.search(
query=query,
)
print(f"Found {len(search.events)} events, including {search.events[0].name}, that match the query '{query}'.")
except Exception as e:
print(f"There was an error: {e}")