Utility functions to serialize xml from object
Project description
acdh-obj2xml-pyutils
python library to parse BaseRowClient of acdh-baserow-pyutils or any array of objects.
HowTo developer
- create python environment
python -m venv env
- install
pip install acdh_obj2xml_pyutils
(not yet published) - install
pip install acdh_baserow_pyutils
(not yet published) - create python file e.g.
run.py
add code
from acdh_obj2xml_pyutils import ObjectToXml
br_input = [{"id": "test1", "filename": "test1"},{"id": "test2", "filename": "test2"}]
tei = ObjectToXml(br_input=br_input)
output = [x for x in tei.make_xml(save=True)]
print(output)
with BaseRowClient
from acdh_obj2xml_pyutils import ObjectToXml
from acdh_baserow_pyutils import BaseRowClient
br_client = BaseRowClient(br_base_url="add url", br_table_id='add id', br_token='add token')
br_input = [x for x in br_client.yield_rows()]
tei = ObjectToXml(br_input=br_input)
output = [x for x in tei.make_xml(save=True)]
print(output)
both versions will create an 'out' directory containing xml files. Important Note! To create filenames the data input must contain a variable with filennames. Default variable is called 'filename' but can be customized by providing an argument to class ObjectToXml().
Arguments
- br_input
data input as array of objects
- save_dir
default out as string
- filename
variable for filenames as string
- template_path
path for jinja2 template
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for acdh_obj2xml_pyutils-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bf960d394d9b83d91834a3cab87a9f13ceebde94bd2c912f135de4da9e6f932 |
|
MD5 | 50a5c31e0ddadab527a57e5f24013483 |
|
BLAKE2b-256 | d65d1b42a5497201f2fead61a2f82d9282878a1ee73e629acf90f484e04eefa6 |
Close
Hashes for acdh_obj2xml_pyutils-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea5579552c0deda5bd9c5df5afaa6c34aed4133f07508d9e5107ad62fc2dbc7d |
|
MD5 | 85e0f9ca31490ff4e7d6c6f7d2adc876 |
|
BLAKE2b-256 | 2d9cd88211d0d56c10ccff6a679803d6ec4dbf56475cda8151735f81630c4b2f |