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
- Raycast Script Commands
Using the NorTax package is easy. Just follow the steps below.
Python REPL:
from nortax import Tax
Python REPL:
tax = Tax(
gross_income=25000,
tax_table="7100",
income_type="Pension",
period="2 weeks",
year=2022,
)
Python REPL:
print(repr(tax))
Output:
Tax(gross_income=25000, tax_table='7100', income_type='Pension', period='2 weeks', year=2022)
Python REPL:
tax.gross_income = 65625
tax.tax_table = "7107"
tax.income_type = "Wage"
tax.period = "Monthly"
tax.year = 2023
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}...
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
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
Python REPL:
print(f"Income type: {tax.income_type}")
Output:
Income type: Wage
Python REPL:
print(f"Period: {tax.period}")
Output:
Period: Monthly
Python REPL:
print(f"Year: {tax.year}")
Output:
Year: 2023
Python REPL:
print(f"Gross income: {tax.gross_income}")
Output:
Gross income: 65625
Python REPL:
print(f"Tax deduction: {tax.deduction}")
Output:
Tax deduction: 21078
Python REPL:
print(f"Net income: {tax.net_income}")
Output:
Net income: 44547
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": ...
This package is also available as a Raycast script command. Just add the raycast_scripts
folder to your Raycast script commands folder and you are good to go.