time-link / timelink-py

Timelink Python Package
MIT License
3 stars 0 forks source link

Expose import_from_xml in TimelinkDatabase #18

Open joaquimrcarvalho opened 8 months ago

joaquimrcarvalho commented 8 months ago

Add TimelinkDatabase.import(...)

This could be a overloaded import(something,**kwargs)

If something is

# direct from url
xml_url = "https://raw.githubusercontent.com/time-link/timelink-py/main/tests/xml_data/b1685.xml"
db = TimelinkDatabase()
db.import(url)

# from Kleio server
valid = tlnb.kleio_server.translation_status(path='',recurse='yes',status='V')
tbnl.import_from_kleio(valid[0])

# url implies Kleio Server
kserver_url = "'/rest/exports/kleio/reference_sources/varia/Devedores.xml'"
tbml.import(server_url)

# from the file system:
file = "tests/xml_data/b1685.xml"
tbnl.import(file)

https://github.com/time-link/timelink-py/blob/6bdbb706e8dd83cfac66d11e0bc74e2bbc41b542/timelink/api/database.py#L659