nortax


Namenortax JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/lewiuberg/nortax
SummaryA Python client for the tax table portion of the Norwegian tax authority's API
upload_time2023-07-10 19:18:00
maintainerLewi Uberg
docs_urlNone
authorLewi Uberg
requires_python>=3.11.1,<4.0.0
license
keywords tax norway api client tax table tax authority nortax
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NorTax <!-- omit in toc -->

[![GitHub License](https://img.shields.io/github/license/lewiuberg/nortax?color=blue)](LICENSE)
![Python](https://img.shields.io/pypi/pyversions/nortax.svg?color=blue)
[![PyPI](https://img.shields.io/pypi/v/nortax.svg?color=blue)](https://pypi.org/project/nortax/)
[![Downloads](https://pepy.tech/badge/nortax)](https://pepy.tech/project/nortax)
[![Codecov code coverage](https://img.shields.io/codecov/c/github/lewiuberg/nortax?color=blue)](https://app.codecov.io/gh/lewiuberg/nortax)
![Github Contributors](https://img.shields.io/github/contributors/lewiuberg/nortax?color=blue)
![GitHub search hit counter](https://img.shields.io/github/search/lewiuberg/nortax/nortax?label=nortax%20searches)
[![GitHub issues](https://img.shields.io/github/issues-raw/lewiuberg/nortax)](https://github.com/lewiuberg/nortax/issues)
![GitHub last commit](https://img.shields.io/github/last-commit/lewiuberg/nortax)

Copyright 2023 [Lewi Lie Uberg](https://uberg.me/)\
_Released under the MIT license_

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

- [Usage](#usage)
  - [Import the Tax class from the nortax package](#import-the-tax-class-from-the-nortax-package)
  - [Create a Tax object](#create-a-tax-object)
  - [Print the representation of the Tax object](#print-the-representation-of-the-tax-object)
  - [Change some attributes of the Tax object](#change-some-attributes-of-the-tax-object)
  - [Print the Tax object](#print-the-tax-object)
  - [Get specific values from the Tax object](#get-specific-values-from-the-tax-object)
    - [Get the URL](#get-the-url)
    - [Get the tax table](#get-the-tax-table)
    - [Get the income type](#get-the-income-type)
    - [Get the period](#get-the-period)
    - [Get the year](#get-the-year)
    - [Get the gross income](#get-the-gross-income)
    - [Get the tax deduction](#get-the-tax-deduction)
    - [Get the net income](#get-the-net-income)
    - [Get the whole table](#get-the-whole-table)

## Usage

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

### Import the Tax class from the nortax package

**Python REPL:**

```python
from nortax import Tax
```

### Create a Tax object

**Python REPL:**

```python
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:**

```python
print(repr(tax))
```

**Output:**

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

### Change some attributes of the Tax object

**Python REPL:**

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

### Print the Tax object

**Python REPL:**

```python
print(tax)
```

**Output:**

```shell
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:**

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

**Output:**

```shell
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:**

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

**Output:**

```shell
Tax table: 7107
```

#### Get the income type

**Python REPL:**

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

**Output:**

```shell
Income type: Wage
```

#### Get the period

**Python REPL:**

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

**Output:**

```shell
Period: Monthly
```

#### Get the year

**Python REPL:**

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

**Output:**

```shell
Year: 2023
```

#### Get the gross income

**Python REPL:**

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

**Output:**

```shell
Gross income: 65625
```

#### Get the tax deduction

**Python REPL:**

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

**Output:**

```shell
Tax deduction: 21078
```

#### Get the net income

**Python REPL:**

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

**Output:**

```shell
Net income: 44547
```

#### Get the whole table

**Python REPL:**

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

**Output:**

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lewiuberg/nortax",
    "name": "nortax",
    "maintainer": "Lewi Uberg",
    "docs_url": null,
    "requires_python": ">=3.11.1,<4.0.0",
    "maintainer_email": "lewiuberg@icloud.com",
    "keywords": "tax,norway,api,client,tax table,tax authority,nortax",
    "author": "Lewi Uberg",
    "author_email": "lewiuberg@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/7a/e1/aa3302754669ce4dd9bfae534df0b49e13b9eaa6c77ee8555d7987a7e993/nortax-0.1.0.tar.gz",
    "platform": null,
    "description": "# NorTax <!-- omit in toc -->\n\n[![GitHub License](https://img.shields.io/github/license/lewiuberg/nortax?color=blue)](LICENSE)\n![Python](https://img.shields.io/pypi/pyversions/nortax.svg?color=blue)\n[![PyPI](https://img.shields.io/pypi/v/nortax.svg?color=blue)](https://pypi.org/project/nortax/)\n[![Downloads](https://pepy.tech/badge/nortax)](https://pepy.tech/project/nortax)\n[![Codecov code coverage](https://img.shields.io/codecov/c/github/lewiuberg/nortax?color=blue)](https://app.codecov.io/gh/lewiuberg/nortax)\n![Github Contributors](https://img.shields.io/github/contributors/lewiuberg/nortax?color=blue)\n![GitHub search hit counter](https://img.shields.io/github/search/lewiuberg/nortax/nortax?label=nortax%20searches)\n[![GitHub issues](https://img.shields.io/github/issues-raw/lewiuberg/nortax)](https://github.com/lewiuberg/nortax/issues)\n![GitHub last commit](https://img.shields.io/github/last-commit/lewiuberg/nortax)\n\nCopyright 2023 [Lewi Lie Uberg](https://uberg.me/)\\\n_Released under the MIT license_\n\nA Python client for the tax table portion of the Norwegian tax authority's API.\n\n- [Usage](#usage)\n  - [Import the Tax class from the nortax package](#import-the-tax-class-from-the-nortax-package)\n  - [Create a Tax object](#create-a-tax-object)\n  - [Print the representation of the Tax object](#print-the-representation-of-the-tax-object)\n  - [Change some attributes of the Tax object](#change-some-attributes-of-the-tax-object)\n  - [Print the Tax object](#print-the-tax-object)\n  - [Get specific values from the Tax object](#get-specific-values-from-the-tax-object)\n    - [Get the URL](#get-the-url)\n    - [Get the tax table](#get-the-tax-table)\n    - [Get the income type](#get-the-income-type)\n    - [Get the period](#get-the-period)\n    - [Get the year](#get-the-year)\n    - [Get the gross income](#get-the-gross-income)\n    - [Get the tax deduction](#get-the-tax-deduction)\n    - [Get the net income](#get-the-net-income)\n    - [Get the whole table](#get-the-whole-table)\n\n## Usage\n\nUsing the NorTax package is easy. Just follow the steps below.\n\n### Import the Tax class from the nortax package\n\n**Python REPL:**\n\n```python\nfrom nortax import Tax\n```\n\n### Create a Tax object\n\n**Python REPL:**\n\n```python\ntax = Tax(\ngross_income=25000,\ntax_table=\"7100\",\nincome_type=\"Pension\",\nperiod=\"2 weeks\",\nyear=2022,\n)\n```\n\n### Print the representation of the Tax object\n\n**Python REPL:**\n\n```python\nprint(repr(tax))\n```\n\n**Output:**\n\n```shell\nTax(gross_income=25000, tax_table='7100', income_type='Pension', period='2 weeks', year=2022)\n```\n\n### Change some attributes of the Tax object\n\n**Python REPL:**\n\n```python\ntax.gross_income = 65625\ntax.tax_table = \"7107\"\ntax.income_type = \"Wage\"\ntax.period = \"Monthly\"\ntax.year = 2023\n```\n\n### Print the Tax object\n\n**Python REPL:**\n\n```python\nprint(tax)\n```\n\n**Output:**\n\n```shell\nURL: str = https://api-tabellkort.app.skatteetaten.no/?valgtTabell=7107&valgtInntektType=Lonn&valgtPeriode=PERIODE_1_MAANED&valgtLonn=65625&visHeleTabellen=True&valgtAar=2023&hentHeleTabellen=True\nTax table: valid_tables = 7107\nIncome type: income_type = Wage\nPeriod: period = Monthly\nYear: int = 2023\nGross income: int = 65625\nTax deduction: int = 21078\nNet income: int = 44547\nReturn whole table: {'5600': 0, '5700': 1, '5800': 30}...\n```\n\n### Get specific values from the Tax object\n\n#### Get the URL\n\n**Python REPL:**\n\n```python\nprint(f\"URL: {tax.url}\")\n```\n\n**Output:**\n\n```shell\nURL: https://api-tabellkort.app.skatteetaten.no/?valgtTabell=7107&valgtInntektType=Lonn&valgtPeriode=PERIODE_1_MAANED&valgtLonn=65625&visHeleTabellen=True&valgtAar=2023&hentHeleTabellen=True\n```\n\n#### Get the tax table\n\nIt 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.\n\n**Python REPL:**\n\n```python\nprint(f\"Tax table: {tax.tax_table}\")\n```\n\n**Output:**\n\n```shell\nTax table: 7107\n```\n\n#### Get the income type\n\n**Python REPL:**\n\n```python\nprint(f\"Income type: {tax.income_type}\")\n```\n\n**Output:**\n\n```shell\nIncome type: Wage\n```\n\n#### Get the period\n\n**Python REPL:**\n\n```python\nprint(f\"Period: {tax.period}\")\n```\n\n**Output:**\n\n```shell\nPeriod: Monthly\n```\n\n#### Get the year\n\n**Python REPL:**\n\n```python\nprint(f\"Year: {tax.year}\")\n```\n\n**Output:**\n\n```shell\nYear: 2023\n```\n\n#### Get the gross income\n\n**Python REPL:**\n\n```python\nprint(f\"Gross income: {tax.gross_income}\")\n```\n\n**Output:**\n\n```shell\nGross income: 65625\n```\n\n#### Get the tax deduction\n\n**Python REPL:**\n\n```python\nprint(f\"Tax deduction: {tax.deduction}\")\n```\n\n**Output:**\n\n```shell\nTax deduction: 21078\n```\n\n#### Get the net income\n\n**Python REPL:**\n\n```python\nprint(f\"Net income: {tax.net_income}\")\n```\n\n**Output:**\n\n```shell\nNet income: 44547\n```\n\n#### Get the whole table\n\n**Python REPL:**\n\n```python\nprint(f\"Return whole table: {json.dumps(tax.get_whole_table(), indent=4)}\")\n```\n\n**Output:**\n\n```shell\nReturn whole table: {\n    \"5600\": 0,\n    \"5700\": 1,\n    \"5800\": 30,\n    \"5900\": 59,\n    \"6000\": 88,\n    \"6100\": 116,\n    \"6200\": 145,\n    \"6300\": 174,\n    \"6400\": 203,\n    \"6500\": ...\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python client for the tax table portion of the Norwegian tax authority's API",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/lewiuberg/nortax/blob/main/README.md",
        "Homepage": "https://github.com/lewiuberg/nortax",
        "Repository": "https://github.com/lewiuberg/nortax"
    },
    "split_keywords": [
        "tax",
        "norway",
        "api",
        "client",
        "tax table",
        "tax authority",
        "nortax"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "20b3c7a22f87a7658d9066727bf35f27aa7b0043fa51e222bc900368da07f824",
                "md5": "7d092af64eb94ebb14d669313b6b9c7d",
                "sha256": "88a7fea9625b1e2c109e30ca06627bbddad5395f2e9fd779e4e1fdfd1ee01bba"
            },
            "downloads": -1,
            "filename": "nortax-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d092af64eb94ebb14d669313b6b9c7d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11.1,<4.0.0",
            "size": 6785,
            "upload_time": "2023-07-10T19:17:58",
            "upload_time_iso_8601": "2023-07-10T19:17:58.614084Z",
            "url": "https://files.pythonhosted.org/packages/20/b3/c7a22f87a7658d9066727bf35f27aa7b0043fa51e222bc900368da07f824/nortax-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ae1aa3302754669ce4dd9bfae534df0b49e13b9eaa6c77ee8555d7987a7e993",
                "md5": "177af63c8e577868ceeda5d3da32ceff",
                "sha256": "bdf20d9b45a43f7e354739556dd7192d17d7dd7b803ffbf59b06febf062509b0"
            },
            "downloads": -1,
            "filename": "nortax-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "177af63c8e577868ceeda5d3da32ceff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11.1,<4.0.0",
            "size": 7436,
            "upload_time": "2023-07-10T19:18:00",
            "upload_time_iso_8601": "2023-07-10T19:18:00.055536Z",
            "url": "https://files.pythonhosted.org/packages/7a/e1/aa3302754669ce4dd9bfae534df0b49e13b9eaa6c77ee8555d7987a7e993/nortax-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 19:18:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lewiuberg",
    "github_project": "nortax",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nortax"
}
        
Elapsed time: 0.35329s