From 5a3ac81ff9b376d73120d3733a5c8828a64237fc Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 26 Mar 2026 16:36:35 -0600 Subject: [PATCH] feat(session): translate requests 'data' kwarg to rnet equivalents for compatibility --- unshackle/core/session.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/unshackle/core/session.py b/unshackle/core/session.py index bf49286..a7a28e9 100644 --- a/unshackle/core/session.py +++ b/unshackle/core/session.py @@ -480,6 +480,16 @@ class RnetSession: # Remove kwargs rnet doesn't understand kwargs.pop("stream", None) # rnet responses are always lazy + # Translate requests-compatible 'data' kwarg to rnet equivalents + data = kwargs.pop("data", None) + if data is not None: + if isinstance(data, dict): + kwargs["form"] = list(data.items()) + elif isinstance(data, (str, bytes)): + kwargs["body"] = data + else: + kwargs["body"] = data + # Resolve method enum rnet_method = _METHOD_MAP.get(method_upper) if rnet_method is None: