Metadata-Version: 2.3
Name: acdh-baserow-pyutils
Version: 0.11.0
Summary: API client for Baserow
Keywords: Baserow,api client
Author: Peter Andorfer, Daniel Elsner
Author-email: Peter Andorfer <peter.andorfer@oeaw.ac.at>, Daniel Elsner <daniel.elsner@oeaw.ac.at>
License: MIT License
         
         Copyright (c) 2022 Austrian Centre for Digital Humanities & Cultural Heritage
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Requires-Dist: requests>=2.32.5
Requires-Python: >=3.9
Project-URL: Documentation, https://acdh-oeaw.github.io/acdh-baserow-pyutils/
Project-URL: Repository, https://github.com/acdh-oeaw/acdh-baserow-pyutils
Description-Content-Type: text/markdown

[![flake8 Lint](https://github.com/acdh-oeaw/acdh-baserow-pyutils/actions/workflows/lint.yml/badge.svg)](https://github.com/acdh-oeaw/acdh-baserow-pyutils/actions/workflows/lint.yml)
[![Test](https://github.com/acdh-oeaw/acdh-baserow-pyutils/actions/workflows/test.yml/badge.svg)](https://github.com/acdh-oeaw/acdh-baserow-pyutils/actions/workflows/test.yml)
[![codecov](https://codecov.io/github/acdh-oeaw/acdh-baserow-pyutils/branch/main/graph/badge.svg?token=8B1K7Y36HN)](https://codecov.io/github/acdh-oeaw/acdh-baserow-pyutils)
[![PyPI version](https://badge.fury.io/py/acdh-baserow-pyutils.svg)](https://badge.fury.io/py/acdh-baserow-pyutils)

# acdh-baserow-pyutils
a python client for baserow

## install

`pip install acdh-baserow-pyutils`


## how to use

Have a look into `tests/test_baserow_client.py`

### dump all tables of a given database into JSON-FILES

```python
import os
from acdh_baserow_utils import BaseRowClient

# store baserow credentials as ENV-Variables
BASEROW_USER = os.environ.get("BASEROW_USER")
BASEROW_PW = os.environ.get("BASEROW_PW")
BASEROW_TOKEN = os.environ.get("BASEROW_TOKEN") # you need to create a token via baserow
DATABASE_ID = "41426" # you can get this ID from Baserow

# initialize the client
br_client = BaseRowClient(BASEROW_USER, BASEROW_PW, BASEROW_TOKEN)

# writes all tables from Database as json.files into a folder 'out' (the folder needs to exist!) and returns a list of the file names
files = br_client.dump_tables_as_json(DATABASE_ID, folder_name='out')
print(files)
# ['out/place.json', 'out/person.json', 'out/profession.json']
```

