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 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.2.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nagerapi-0.2.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nagerapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 19b0dc02bb8627a3f1851d521caa6f51ceb565aa0932a7d7ec33cddd23924d5a
MD5 1889d74fe766da93f1954bcee5369e29
BLAKE2b-256 9a128d468160fef365ab718ae6d2a8acec206310d8b8540ce2132e34f413b750

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nagerapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9690a0f3951a539b372503fb6d14af0c24c7790303607837629a7355745cde09
MD5 da8099262b9f052943336ac7da51951b
BLAKE2b-256 5671da7539ec84a1fde983f319b5eb4fa1c6dd5f51f928870607d1f5e65d7a8d

See more details on using hashes here.

Supported by

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