Skip to content

Commit

Permalink
Apply lint, black, run tests in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
vsalomaki committed Feb 2, 2025
1 parent c72b165 commit 2a60efc
Show file tree
Hide file tree
Showing 52 changed files with 288 additions and 207 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1)](https://pycqa.github.io/isort/)

___

---

Python client for the Netvisor API.

___
---

## Installation

Expand All @@ -21,7 +20,7 @@ You can install netvisor with pip::

## Usage example

````python
```python
from netvisor_api_client import Netvisor
from datetime import date, timedelta

Expand All @@ -42,29 +41,32 @@ invoices = client.sales_invoices.list(start_date=date.today() - timedelta(days=1

# Get detailed information for the first invoice
invoice_details = client.sales_invoices.get(invoices[0]['netvisor_key'])
````
```

## Running tests

Run tests locally using pytest or by running docker
`docker run --rm -it $(docker build -f tests.dockerfile -q .)`

Known issues
------------
## Known issues

### Language

Using language other than `EN` can cause failures when parsing responses containing localised boolean like values.

Example: `"Yes"` and `"No"` parsed to bool `True` and `False` fails when language is FI

````python
```python
from netvisor_api_client.schemas.fields import Boolean

# Current schema
match_partial_payments_by_default = Boolean(true="Yes", false="No")

# i.e. for FI this should be
# i.e. for FI this should be
match_partial_payments_by_default = Boolean(true="Kyllä", false="Ei")
````
```

Resources
---------
## Resources

* Bug Tracker <https://github.com/Heltti/netvisor-api-client/issues>
* Code <https://github.com/Heltti/netvisor-api-client>
- Bug Tracker <https://github.com/Heltti/netvisor-api-client/issues>
- Code <https://github.com/Heltti/netvisor-api-client>
10 changes: 5 additions & 5 deletions netvisor_api_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
Netvisor API Client
~~~~~~~~
Netvisor API Client
~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

__version__ = "0.9.4"

from .core import Netvisor # flake8: noqa
from .core import Netvisor # noqa: F401
9 changes: 5 additions & 4 deletions netvisor_api_client/auth.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.auth
~~~~~~~~~~~~~
netvisor.auth
~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from __future__ import absolute_import

import datetime
Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.client
~~~~~~~~~~~~~~~
netvisor.client
~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from __future__ import absolute_import

import requests
Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/core.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.core
~~~~~~~~~~~~~
netvisor.core
~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from .auth import NetvisorAuth
from .client import Client
from .services.accounting import AccountingService
Expand Down
8 changes: 4 additions & 4 deletions netvisor_api_client/exc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
netvisor.exc
~~~~~~~~~~~~
netvisor.exc
~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""


Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/requests/accounting.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.requests.accounting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.requests.accounting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..responses.accounting import AccountingListResponse, CreateAccountingResponse
from ..schemas.accounting import CreateAccountingVoucherSchema
from .base import Request
Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/requests/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.requests.base
~~~~~~~~~~~~~~~~~~~~~~
netvisor.requests.base
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

import inflection
import xmltodict

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/requests/company.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.requests.company
~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.requests.company
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..responses.companies import CompanyListResponse, GetCompanyInformationResponse
from .base import Request

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/requests/customer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.requests.customer
~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.requests.customer
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..responses.customers import (
CreateCustomerResponse,
CustomerListResponse,
Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/requests/product.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.requests.product
~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.requests.product
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from marshmallow import ValidationError

from ..exc import InvalidData
Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/requests/sales_invoice.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.requests.sales_invoice
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.requests.sales_invoice
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from marshmallow import ValidationError

from ..exc import InvalidData
Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/requests/sales_payment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.requests.sales_payment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.requests.sales_payment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..responses.sales_payments import SalesPaymentListResponse
from .base import Request

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/responses/accounting.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.responses.accounting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.responses.accounting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..schemas import AccountingListSchema, RepliesSchema
from .base import Response

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/responses/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.responses.base
~~~~~~~~~~~~~~~~~~~~~~~
netvisor.responses.base
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

import inflection
import xmltodict

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/responses/companies.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.responses.companies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.responses.companies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..schemas import CompanyListSchema, GetCompanyInformationSchema
from .base import Response

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/responses/customers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.responses.customers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.responses.customers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..schemas import CustomerListSchema, GetCustomerSchema, RepliesSchema
from .base import Response

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/responses/products.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.responses.products
~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.responses.products
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..schemas import GetProductSchema, ProductListSchema, RepliesSchema
from .base import Response

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/responses/sales_invoices.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.responses.sales_invoices
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.responses.sales_invoices
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..schemas import GetSalesInvoiceSchema, RepliesSchema, SalesInvoiceListSchema
from .base import Response

Expand Down
9 changes: 5 additions & 4 deletions netvisor_api_client/responses/sales_payments.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""
netvisor.responses.sales_payments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netvisor.responses.sales_payments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""

from ..schemas import SalesPaymentListSchema
from .base import Response

Expand Down
Loading

0 comments on commit 2a60efc

Please sign in to comment.