Skip to main content

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_string())

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")

Run tests

Test are written for the pytest framework. Install it with:

$ poetry install pytest

Run the tests with:

$ poetry run pytest

Release files for sla-calculator 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sla-calculator 1.0.0
File Size Uploaded
sla-calculator-1.0.0.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sla-calculator 1.0.0
File Interpreter ABI Platform
sla_calculator-1.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 5.2 kB

Release files / sla-calculator-1.0.0.tar.gz

Download URL sla-calculator-1.0.0.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fb01d68cfd61eac74cd8ac2aaec4ab89b568e8f58094c65a372f0ceb1d77806d
BLAKE2b-256 checksum
How to use checksums
2499491c4fcece3637194c3633f74355b47bf4d0a6d286d0cb2cc10f56944550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.3 CPython/3.7.6 Darwin/19.6.0

Release files / sla_calculator-1.0.0-py2.py3-none-any.whl

Download URL sla_calculator-1.0.0-py2.py3-none-any.whl
Size 2.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b5f8d75d4823137eb7c2be4aa18414c35223581877c79829ac619ef4adf1aa53
BLAKE2b-256 checksum
How to use checksums
d30ebab79958a2a4725d7becf91fc563df421b58f9e997eb6d80f6004c2c0397
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.3 CPython/3.7.6 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page