Skip to main content

Checking the date for belonging to a non-working day, according to official decrees and orders.

Project description

isdayoff

Production Calendar API

Description:

  • Checking the date for belonging to a non-working day, according to official decrees and orders.

Official API website - https://isdayoff.ru

install

pip install isdayoff

Checking tomorrow

import asyncio

from isdayoff import DateType, ProdCalendar

calendar = ProdCalendar(locale='us')


async def main():
    if await calendar.tomorrow() == DateType.WORKING:
        print('Tomorrow is a working day')
    else:
        print('Tomorrow is a day off')
    
    
loop = asyncio.get_event_loop()
loop.create_task(main())
loop.run_forever()

Checking today

params

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.today(locale='ru', pre=True, covid=True, sd=True)

Weekend on this date

params

  • date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

import asyncio
from datetime import date

from isdayoff import DateType, ProdCalendar

calendar = ProdCalendar(locale='us')


async def main():
    if await calendar.date(date(2021, 8, 25)) == DateType.WORKING:
        print('Is a working day')
    else:
        print('Is a day off')
...

Getting information about days for a month

  • date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.month(date(2021, 8, 1))

Getting information about days for the year

  • date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.year(date(2021, 1, 1))

Getting information about days for a derived period

  • start_date: datetime.date - date

  • end_date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.range_date(date(2021, 1, 1), date(2021, 5, 1))

Is it a leap year

  • date: datetime.date - date
await calendar.is_leap(date(2021, 1, 1))

Example

from isdayoff import ProdCalendar, DateType
from datetime import date
import asyncio


calendar = ProdCalendar(locale='us')


async def main():
    res = await calendar.month(date(2021, 8, 1), locale='ru')
    count = len([DateType.NOT_WORKING for day in res if res[day] == DateType.NOT_WORKING])
    print('Days off in a month', count)

loop = asyncio.get_event_loop()
loop.create_task(main())
loop.run_forever()

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

isdayoff-1.0.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.

isdayoff-1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file isdayoff-1.0.tar.gz.

File metadata

  • Download URL: isdayoff-1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.8

File hashes

Hashes for isdayoff-1.0.tar.gz
Algorithm Hash digest
SHA256 93a555a81e0f9a8bd5c29377aaed5a581a1fe5c9d2269994f4afbc6ee9162b61
MD5 26da719d3bd67dbc12fd0e5d0312a58c
BLAKE2b-256 4536d581e2611e8b867953e8a59e76e47c01f87a6a14859a6c39839c19ee45e3

See more details on using hashes here.

File details

Details for the file isdayoff-1.0-py3-none-any.whl.

File metadata

  • Download URL: isdayoff-1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.8

File hashes

Hashes for isdayoff-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 165e53b75fb028c20f3af4df9a0ec39983cb425469a0919c1922233401413766
MD5 da889f79c40d2badd5c4407bb62cde96
BLAKE2b-256 da1ae837389574d698add7be110ec54f6a90c083919959f5c520000e4a031619

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