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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7dfe2d1954b8c7ec07f24ff6d01b59c75e98ba6d20ff7d6bd7aecf100a399e0 |
|
MD5 | 994fb90369c9f371241971b50da45a40 |
|
BLAKE2b-256 | aaf5d31dc9a5978ac52e09eb68a37fa1920a2a808d32519deca91ad44bf57c69 |
Close
Hashes for acdh_obj2xml_pyutils-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71aa393fed06613b586260516fe5d6e2ff9f3ba9c26c4eff05e1b82650a9f734 |
|
MD5 | d3a2a73bd25a710c482eb732098ad277 |
|
BLAKE2b-256 | 60a898c5e0612394ec2ace68bd3a28cab040c4060c7f703f0dd99d9844ce4521 |