Skip to main content

A python module that will calculate the sla time based on working hours and holidays.

Project description

SLA Calculator

Installation

pip install sla-calculator

Usage

To use this calculator, you must provide a starting time, the open time for business, the closing time for business, the country whose holidays you observe, and the sla time in hours. The function will then take into account all holidays and weekends as none working hours, and return a pendulum object of the time the sla needs to be met by. The following example will provide you with an SLA time 4 working hours from 12/10/2019 1:02:03 UTC

from sla_calculator import SLA_Calculator

sla_calc = SLA_Calculator()

sla_time = sla_calc.calculate(start_time="2019-12-10T01:02:03Z",
                              open_hour=9,
                              close_hour=17,
                              country_name="US",
                              sla_in_hours=4)
print(sla_time.to_iso8601_format())

Locale Specification

You can also specify the province or state that you are in to get a more specific set of holidays:

sla_time = sla_calc.calculate(start_time="2019-12-10T01:02:03Z",
                              open_hour=9,
                              close_hour=17,
                              country_name="US",
                              sla_in_hours=4,
                              state="CO")

Or:

sla_time = sla_calc.calculate(start_time="2019-12-10T01:02:03Z",
                              open_hour=9,
                              close_hour=17,
                              country_name="Switzerland",
                              sla_in_hours=4,
                              province="Zurich")

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

sla-calculator-0.3.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

sla_calculator-0.3.0-py2.py3-none-any.whl (2.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sla-calculator-0.3.0.tar.gz.

File metadata

  • Download URL: sla-calculator-0.3.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/2.7.15 Windows/10

File hashes

Hashes for sla-calculator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 10aee305d27cb6b0fa8bcb5a11bfeb2ff224e5a9b45eb6e1b32043188eb1bee1
MD5 4df12e00a082f5e4b0beec0bd7c8a493
BLAKE2b-256 3c91268ae20d6023d969ff30de476d501be7c981d663d0403c53e3ab6341a0b0

See more details on using hashes here.

File details

Details for the file sla_calculator-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: sla_calculator-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/2.7.15 Windows/10

File hashes

Hashes for sla_calculator-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 08ac511f4a155b1c48adef16b223c23cc77e6b37193d53db6c0212d95f735727
MD5 bc5f1c287a2cf81a3bb05f6959ef7a28
BLAKE2b-256 3319432f514669e7aa540359430a8b17a24224802d56089761850e3f18be79aa

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