Summary
API._dispatch_request returns the string "GET" as its fallback instead of a callable, so an unknown HTTP method raises TypeError (str is not callable) rather than dispatching or failing cleanly.
Location
datamaxi/api.py:188-194
def _dispatch_request(self, http_method):
return {
"GET": self.session.get,
"DELETE": self.session.delete,
"PUT": self.session.put,
"POST": self.session.post,
}.get(http_method, "GET") # <-- fallback is the literal string "GET"
send_request then does self._dispatch_request(http_method)(**params). For any method not in the dict the result is "GET"(**params) → TypeError: 'str' object is not callable.
Impact
Latent. Currently harmless only because methods come from the spec-driven registry, but it's a bug waiting for the first unexpected method and the error is misleading.
Fix
Fall back to self.session.get (the intended default), or raise a clear ValueError(f"unsupported HTTP method: {http_method}").
Surfaced during a pythonic-idiom review of the SDK.
Summary
API._dispatch_requestreturns the string"GET"as its fallback instead of a callable, so an unknown HTTP method raisesTypeError(stris not callable) rather than dispatching or failing cleanly.Location
datamaxi/api.py:188-194send_requestthen doesself._dispatch_request(http_method)(**params). For any method not in the dict the result is"GET"(**params)→TypeError: 'str' object is not callable.Impact
Latent. Currently harmless only because methods come from the spec-driven registry, but it's a bug waiting for the first unexpected method and the error is misleading.
Fix
Fall back to
self.session.get(the intended default), or raise a clearValueError(f"unsupported HTTP method: {http_method}").Surfaced during a pythonic-idiom review of the SDK.