api-client icon indicating copy to clipboard operation
api-client copied to clipboard

post() does not support arrays

Open marshall-ucsd opened this issue 1 year ago • 0 comments

Python 3.11, api-client 1.3.1

I am accessing a REST API where the POST data is an array of object (i.e., Sequence[dict]) - the signature of RequestStrategy.post() only accepts dict (object), which generates type-mismatch errors in IDEs such as PyCharm: Expected type 'dict', got 'Sequence[dict]' instead

To Reproduce Steps to reproduce the behavior:

  1. Call post() with a list (e.g., [])

Expected behavior Arrays are valid JSON so they should be accepted in the method signature.

Typing in Python is more advisory than enforced so this does not impact execution but can create confusion with any type-checking.

marshall-ucsd avatar Jul 09 '23 20:07 marshall-ucsd