Skip to main content

NorTax

GitHub License Python PyPI Downloads Codecov code coverage Github Contributors GitHub search hit counter GitHub issues GitHub last commit

Copyright 2023 Lewi Lie Uberg
Released under the MIT license

A Python client for the tax table portion of the Norwegian tax authority's API.

Usage

Using the NorTax package is easy. Just follow the steps below.

Import the Tax class from the nortax package

Python REPL:

from nortax import Tax

Create a Tax object

Python REPL:

tax = Tax(
gross_income=25000,
tax_table="7100",
income_type="Pension",
period="2 weeks",
year=2022,
)

Print the representation of the Tax object

Python REPL:

print(repr(tax))

Output:

Tax(gross_income=25000, tax_table='7100', income_type='Pension', period='2 weeks', year=2022)

Change some attributes of the Tax object

Python REPL:

tax.gross_income = 65625
tax.tax_table = "7107"
tax.income_type = "Wage"
tax.period = "Monthly"
tax.year = 2023

Print the Tax object

Python REPL:

print(tax)

Output:

URL: str = https://api-tabellkort.app.skatteetaten.no/?valgtTabell=7107&valgtInntektType=Lonn&valgtPeriode=PERIODE_1_MAANED&valgtLonn=65625&visHeleTabellen=True&valgtAar=2023&hentHeleTabellen=True
Tax table: valid_tables = 7107
Income type: income_type = Wage
Period: period = Monthly
Year: int = 2023
Gross income: int = 65625
Tax deduction: int = 21078
Net income: int = 44547
Return whole table: {'5600': 0, '5700': 1, '5800': 30}...

Get specific values from the Tax object

Get the URL

Python REPL:

print(f"URL: {tax.url}")

Output:

URL: https://api-tabellkort.app.skatteetaten.no/?valgtTabell=7107&valgtInntektType=Lonn&valgtPeriode=PERIODE_1_MAANED&valgtLonn=65625&visHeleTabellen=True&valgtAar=2023&hentHeleTabellen=True

Get the tax table

It is possible to get specific values from the Tax object. They are all available as attributes. Except for the whole table, which is available as a method.

Python REPL:

print(f"Tax table: {tax.tax_table}")

Output:

Tax table: 7107

Get the income type

Python REPL:

print(f"Income type: {tax.income_type}")

Output:

Income type: Wage

Get the period

Python REPL:

print(f"Period: {tax.period}")

Output:

Period: Monthly

Get the year

Python REPL:

print(f"Year: {tax.year}")

Output:

Year: 2023

Get the gross income

Python REPL:

print(f"Gross income: {tax.gross_income}")

Output:

Gross income: 65625

Get the tax deduction

Python REPL:

print(f"Tax deduction: {tax.deduction}")

Output:

Tax deduction: 21078

Get the net income

Python REPL:

print(f"Net income: {tax.net_income}")

Output:

Net income: 44547

Get the whole table

Python REPL:

print(f"Return whole table: {json.dumps(tax.get_whole_table(), indent=4)}")

Output:

Return whole table: {
    "5600": 0,
    "5700": 1,
    "5800": 30,
    "5900": 59,
    "6000": 88,
    "6100": 116,
    "6200": 145,
    "6300": 174,
    "6400": 203,
    "6500": ...

Metadata

Release files for nortax 0.1.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 nortax 0.1.0
File Size Uploaded
nortax-0.1.0.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nortax 0.1.0
File Interpreter ABI Platform
nortax-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / nortax-0.1.0.tar.gz

Download URL nortax-0.1.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bdf20d9b45a43f7e354739556dd7192d17d7dd7b803ffbf59b06febf062509b0
BLAKE2b-256 checksum
How to use checksums
7ae1aa3302754669ce4dd9bfae534df0b49e13b9eaa6c77ee8555d7987a7e993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.2 Darwin/22.3.0

Release files / nortax-0.1.0-py3-none-any.whl

Download URL nortax-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88a7fea9625b1e2c109e30ca06627bbddad5395f2e9fd779e4e1fdfd1ee01bba
BLAKE2b-256 checksum
How to use checksums
20b3c7a22f87a7658d9066727bf35f27aa7b0043fa51e222bc900368da07f824
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.2 Darwin/22.3.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

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