Skip to main content

Unofficial library for the Salling Group holidays API

Project description

Linux Build Status Windows Build Status Code Coverage

Unofficial library for the Salling Group Holidays API

Unofficial Python 3 library for the Salling Group Holidays API.

The API supports fetching Danish holidays for a given date or range of dates. This library simply provides an abstraction over that API.

Installation

To install this library, type the following into the command prompt:

$ pip install salling-group-holidays

Usage

First of all, an API key is needed to use the Salling Group Holidays API. Contact Salling Group to receive your API key.

Once you have received your key, you can start using this library. Usage is fairly simple. Start by getting an API instance:

import salling_group_holidays

API_KEY = 'your_api_key'
v1 = salling_group_holidays.v1(API_KEY)

To see if a given date is a holiday, use a Python datetime.date object. and call the is_holiday method. For example, to see if today is a Danish holiday:

from datetime import date
import salling_group_holidays

v1 = salling_group_holidays.v1(API_KEY)

if v1.is_holiday(date.today()):
  print('Great news. No work today!')
else:
  print('Get back to work. No holiday today.')

To get a list of holidays for a given period, call the holidays method with a start and end date as a Python datetime.date object. This method returns a Python dictionary with the holiday dates as the key and the name of the day as well as whether it is a holiday. For example to get the list of Danish holidays in December 2018:

from datetime import date
import salling_group_holidays

v1 = salling_group_holidays.v1(API_KEY)
holidays = v1.holidays(date(2018, 12, 1), date(2018, 12, 31))

print('There are {} holidays in December 2018.'.format(len(holidays)))
print('December 25th is {}'.format(holidays[date(2018, 12, 25)]['name']))

Will output:

There are 4 holidays in December 2018
December 25th is 1. juledag.

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

salling-group-holidays-0.4.linux-x86_64.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

salling_group_holidays-0.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file salling-group-holidays-0.4.linux-x86_64.tar.gz.

File metadata

  • Download URL: salling-group-holidays-0.4.linux-x86_64.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for salling-group-holidays-0.4.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 3b4b2bc66b4a6f00f440e095e2e0967217a3208c6f6a7f9b3c277f178dfd7fce
MD5 3ebc83b4b77227a62918d9dde216964a
BLAKE2b-256 8aeb5c9bffe8f92715760b91e3c75df3117929fb13b2fdac2c9b453a4b8dd4e8

See more details on using hashes here.

File details

Details for the file salling_group_holidays-0.4-py3-none-any.whl.

File metadata

  • Download URL: salling_group_holidays-0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for salling_group_holidays-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0b5ada615d6e18c0157c5aad038098b17f7bdc94a82c03be99460054272419c2
MD5 4a8fa960786be7ce55c6a76082fadedd
BLAKE2b-256 0280573ab66802001f51f6c73085f3712585b2591801daf433766ed89b897e35

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