From 7bce3d7b25bf8a7585ee4d471f47ff8e758d76b5 Mon Sep 17 00:00:00 2001 From: zvecr Date: Sun, 17 Jul 2022 23:04:35 +0100 Subject: [PATCH] Prep client gen for header parsing --- data/templates/xap/client/python/routes.py.j2 | 4 +++ data/templates/xap/client/python/types.py.j2 | 30 +++++++++++++++++-- lib/python/xap_client/device.py | 30 +++++++------------ lib/python/xap_client/routes.py | 4 +++ lib/python/xap_client/types.py | 30 +++++++++++++++++-- 5 files changed, 75 insertions(+), 23 deletions(-) diff --git a/data/templates/xap/client/python/routes.py.j2 b/data/templates/xap/client/python/routes.py.j2 index 7497e8afa1d..7eb6a5bde2e 100644 --- a/data/templates/xap/client/python/routes.py.j2 +++ b/data/templates/xap/client/python/routes.py.j2 @@ -1,4 +1,8 @@ +class XAPRouteError(Exception): + pass + + class XAPRoutes(): {%- for id, route in xap.routes | dictsort %} {%- if route.routes %} diff --git a/data/templates/xap/client/python/types.py.j2 b/data/templates/xap/client/python/types.py.j2 index be9b386e143..b6202fa2777 100644 --- a/data/templates/xap/client/python/types.py.j2 +++ b/data/templates/xap/client/python/types.py.j2 @@ -1,8 +1,34 @@ +from collections import namedtuple from enum import IntFlag, IntEnum +from struct import Struct -class XAPRouteError(Exception): - pass +class XAPRequest(namedtuple('XAPRequest', 'token length data')): + fmt = Struct('