File: generate.py

package info (click to toggle)
pygti 0.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 284 kB
  • sloc: python: 1,310; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 544 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Generate library files based on the GTI WADL/XSD."""

import asyncio

import aiohttp
from xsd_to_vol import xsd_to_vol


async def generate():
    async with aiohttp.ClientSession() as session:
        url = "https://api-prod.geofox.de/gti/public/geofoxThinInterfacePublic.xsd"
        async with session.get(url) as resp:
            if resp.status == 200:
                xsd = await resp.read()

                with open("pygti/schemas.py", "w") as vol_file:
                    vol_file.write(xsd_to_vol(xsd))


asyncio.run(generate())