@@ -197,6 +197,12 @@ def __init__(
197197 self ._read_only : bool = _read_only
198198 self ._is_set : bool = False
199199 self ._endpoint : str = getattr (self , "_endpoint" , f"{ self ._label } s" )
200+
201+ # For simvue object initialisation, unlike the server there is no nested
202+ # arguments, however this means that there are extra keys during post which
203+ # need removing, this attribute handles that and should be set in subclasses.
204+ self ._local_only_args : list [str ] = []
205+
200206 self ._identifier : str | None = (
201207 identifier if identifier is not None else f"offline_{ uuid .uuid1 ()} "
202208 )
@@ -633,6 +639,10 @@ def _post_single(
633639 if not is_json :
634640 kwargs = msgpack .packb (data or kwargs , use_bin_type = True )
635641
642+ # Remove any extra keys
643+ for key in self ._local_only_args :
644+ _ = (data or kwargs ).pop (key , None )
645+
636646 _response = sv_post (
637647 url = f"{ self ._base_url } " ,
638648 headers = self ._headers | {"Content-Type" : "application/msgpack" },
@@ -670,6 +680,11 @@ def _post_single(
670680 def _put (self , ** kwargs ) -> dict [str , typing .Any ]:
671681 if not self .url :
672682 raise RuntimeError (f"Identifier for instance of { self ._label } Unknown" )
683+
684+ # Remove any extra keys
685+ for key in self ._local_only_args :
686+ _ = kwargs .pop (key , None )
687+
673688 _response = sv_put (
674689 url = f"{ self .url } " , headers = self ._headers , data = kwargs , is_json = True
675690 )
0 commit comments