ParkenDD / ParkAPI2-sources

Data sources for ParkAPI / parkendd.de
MIT License
3 stars 5 forks source link

stuttgart v3 support, small bugfixes #46

Closed the-infinity closed 10 months ago

the-infinity commented 11 months ago

This adds Stuttgart V3 = push support. It also adds a small library which is capable of doing nice converts from XML to JSON in order to support XML imports.

hbruch commented 11 months ago

Testing with https://data.mfdz.de/DATEXII_Parkdaten_statisch_Stuttgart/body.xml results in

% python test-push-converter.py stuttgart ./temp/stuttgart-statisch.xml
Traceback (most recent call last):
  File "/.../ParkAPI2-sources/test-push-converter.py", line 121, in <module>
    main()
  File "/.../ParkAPI2-sources/test-push-converter.py", line 67, in main
    root_element = etree.fromstring(xml_file.read(), parser=etree.XMLParser(resolve_entities=False))  # noqa: S320
  File "src/lxml/etree.pyx", line 3257, in lxml.etree.fromstring
  File "src/lxml/parser.pxi", line 1911, in lxml.etree._parseMemoryDocument
ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.
the-infinity commented 11 months ago

That's interesting: the data which is dumped at IPL does not have the <?xml version='1.0' encoding='UTF-8'?>. Do you add the delaration at mfdz, or is our dump wrong?

hbruch commented 11 months ago

Seems like the dump is incomplete, mfdz republishes as is provided by Stuttgart (or better: MDM)

the-infinity commented 11 months ago

Ouch. Changed the loading mechanism of the test script, so "the real" Stuttgart is supported.