# OpenKVK: API wrapper
[](https://pypi.python.org/pypi/OpenKVK/)
[](https://travis-ci.org/jeff-99/OpenKVK)
[](https://pypi.python.org/pypi/OpenKVK/)
## What is it ?
OpenKVK is an UNOFFICIAL python wrapper for the [openkvk API](https://openkvk.nl/api.html)
## Main Features
a few of the things this library does well:
- Get dutch company information by name or kvk-number
- Get lists of companies based on sbi-codes, location or both
- Output information in `json`, `csv` or `dict`
- Wrap your own queries with or without result parsing
## Command line interface
For quick access to the openkvk api you could use the OpenKVK CLI, like so:
```sh
openkvk --help
openkvk --kvk 27312152 --format json --output test.json
```
## Installation
The source code is currently hosted on GitHub at:
http://github.com/jeff-99/OpenKVK
Install via `pip`:
```sh
pip install OpenKVK
```
And via `easy_install`:
```sh
easy_install OpenKVK
```
## Example
First you need to instantiate a OpenKVK client
```python
from OpenKVKimport ApiClient
client = ApiClient()
```
The Client returns data as python dicts, to change this output format.
you could do one of the following
```python
client = ApiClient('json')
```
OR
```python
client.setResponseFormat('json')
```
The client can then be used to query by using the following:
```python
client.get_by_kvk(53012321)
client.get_by_city('Rotterdam')
client.get_by_name('KPN')
client.get_by_sbi('06.10')
```
The `city`, `name` and `sbi` functions also accept a maximum number of results (defaults to 99)
and a additional filters, like:
```python
client.get_by_sbi('06.10',limit=150, plaats="Rotterdam")
```
for a full list of available filters check [openkvk](https://www.openkvk.nl/api.html)
If you like to construct you own SQL-queries and you like the results to be parsed to a valid JSON array, a python list of dicts or a valid csv
you could use the `QueryBuilder` class.
```python
from OpenKVK import QueryBuilder
client = QueryBuilder()
client.setResponseFormat('csv')
client.query("SELECT * FROM kvk WHERE kvks = 27312152")
```
If you don't want the parsed results there is also a very minimalistic api client
```python
from OpenKVK import BaseClient
client = BaseClient()
client.setResponseFormat('py')
client.query("SELECT * FROM kvk WHERE kvks = 27312152")
```
## License
MIT
Version 0.4
-----------
- Bugfix QueryBuilder limiter
Version 0.3
-----------
- Added python 3 support
- Fixxed additional filters
- Updated documentation
Version 0.2
-----------
- Added Commandline interface
- Added method for querying bankruptcies
- Added tests
- Added MANIFEST.in
- Restructured classes
- Fixed csv output
- Fixed get_by_kvk() method
Version 0.1
-----------
First public preview release.
[](https://pypi.python.org/pypi/OpenKVK/)
[](https://travis-ci.org/jeff-99/OpenKVK)
[](https://pypi.python.org/pypi/OpenKVK/)
## What is it ?
OpenKVK is an UNOFFICIAL python wrapper for the [openkvk API](https://openkvk.nl/api.html)
## Main Features
a few of the things this library does well:
- Get dutch company information by name or kvk-number
- Get lists of companies based on sbi-codes, location or both
- Output information in `json`, `csv` or `dict`
- Wrap your own queries with or without result parsing
## Command line interface
For quick access to the openkvk api you could use the OpenKVK CLI, like so:
```sh
openkvk --help
openkvk --kvk 27312152 --format json --output test.json
```
## Installation
The source code is currently hosted on GitHub at:
http://github.com/jeff-99/OpenKVK
Install via `pip`:
```sh
pip install OpenKVK
```
And via `easy_install`:
```sh
easy_install OpenKVK
```
## Example
First you need to instantiate a OpenKVK client
```python
from OpenKVKimport ApiClient
client = ApiClient()
```
The Client returns data as python dicts, to change this output format.
you could do one of the following
```python
client = ApiClient('json')
```
OR
```python
client.setResponseFormat('json')
```
The client can then be used to query by using the following:
```python
client.get_by_kvk(53012321)
client.get_by_city('Rotterdam')
client.get_by_name('KPN')
client.get_by_sbi('06.10')
```
The `city`, `name` and `sbi` functions also accept a maximum number of results (defaults to 99)
and a additional filters, like:
```python
client.get_by_sbi('06.10',limit=150, plaats="Rotterdam")
```
for a full list of available filters check [openkvk](https://www.openkvk.nl/api.html)
If you like to construct you own SQL-queries and you like the results to be parsed to a valid JSON array, a python list of dicts or a valid csv
you could use the `QueryBuilder` class.
```python
from OpenKVK import QueryBuilder
client = QueryBuilder()
client.setResponseFormat('csv')
client.query("SELECT * FROM kvk WHERE kvks = 27312152")
```
If you don't want the parsed results there is also a very minimalistic api client
```python
from OpenKVK import BaseClient
client = BaseClient()
client.setResponseFormat('py')
client.query("SELECT * FROM kvk WHERE kvks = 27312152")
```
## License
MIT
Version 0.4
-----------
- Bugfix QueryBuilder limiter
Version 0.3
-----------
- Added python 3 support
- Fixxed additional filters
- Updated documentation
Version 0.2
-----------
- Added Commandline interface
- Added method for querying bankruptcies
- Added tests
- Added MANIFEST.in
- Restructured classes
- Fixed csv output
- Fixed get_by_kvk() method
Version 0.1
-----------
First public preview release.
Release files for OpenKVK 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| OpenKVK-0.4.zip | 377.2 kB | Details |
Release files / OpenKVK-0.4.zip
| Download URL | OpenKVK-0.4.zip |
|---|---|
| Size | 377.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92e3b7bfc3fa0d34c7a2235841770df64e0a382fd817329dc26031459ccdd066
|
|
BLAKE2b-256 checksum How to use checksums |
2e4236a2889fc7ee3bc080c5afdf6f425d8bdeb1d67e2186467b9186fbb49073
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |