Skip to main content

Python wrapper for Nager API https://date.nager.at/Api

Project description

Welcome to Nager Public Holiday API’s documentation!

Build Testing Build Coverage Read the Docs GitHub release (latest by date) PyPI Downloads GitHub commits since latest release (by date) for a branch GitHub Sponsor

Overview

Unofficial Python bindings for the Nager Public Holiday API. The goal is to make interaction with the API as easy as possible.

Installation & Documentation

pip install nagerapi

Documentation can be found at Read the Docs.

Connecting to Nager

Getting a NagerObjectAPI Instance

To connect to the Nager Public Holiday API you use the ~nagerapi.NagerObjectAPI object.

from nagerapi import NagerObjectAPI

nager = NagerObjectAPI()
import nagerapi

nager = nagerapi.NagerObjectAPI()

Usage Examples

Example: List all 2022 US Holidays.

In this one we get the US ~nagerapi.Country Object and call public_holidays from that object.

from nagerapi import NagerObjectAPI

nager = NagerObjectAPI()
country = nager.country("US")

for holiday in country.public_holidays(2022):
    print(f"{holiday.name} is on {holiday.date.strftime('%Y-%m-%d')}")

Alternatively you can call public_holidays from the ~nagerapi.NagerObjectAPI object directly providing the country code.

from nagerapi import NagerObjectAPI

nager = NagerObjectAPI()

for holiday in nager.public_holidays(2022, "US"):
    print(f"{holiday.name} is on {holiday.date.strftime('%Y-%m-%d')}")

Usage & Contributions

  • Source is available on the Github Project Page.

  • Contributors to NagerAPI own their own contributions and may distribute that code under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nagerapi-0.3.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

nagerapi-0.3.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file nagerapi-0.3.1.tar.gz.

File metadata

  • Download URL: nagerapi-0.3.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for nagerapi-0.3.1.tar.gz
Algorithm Hash digest
SHA256 71a50e39df221c2e7778276df48073bff99185fd70e5092cea64015aa502be04
MD5 118665bc442bbcef32ca6bb63396eb50
BLAKE2b-256 438459d1a5892f0d2e512ebbe971635fd7bfb43098d504d9cbbba617fd44bcac

See more details on using hashes here.

File details

Details for the file nagerapi-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: nagerapi-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for nagerapi-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a1518a52cde15f43969ce605496355103e3bbad56bceea335c445b5e9a5e2ee
MD5 ef6087d3b8ed27864b2896efb1eb4771
BLAKE2b-256 278b7febf08093ae07e653df9b11f553f9997120753567436a3a9ed5dcec5926

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page