tremendous-rewards / tremendous-python

Python Tremendous API Client
MIT License
2 stars 6 forks source link

`create_order` gives `NoneType` issues #21

Open FloareDor opened 2 days ago

FloareDor commented 2 days ago

v3 client.create_order never works for some reason.

Here's the error, I've done but what's shown on the migration guide/readme file:

Traceback (most recent call last):
  File "C:\UFL\Tapsta\backend\tapsta_backend\x.py", line 52, in <module>
    response = client.create_order(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\91707\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-Q2UNHawR-py3.12\Lib\site-packages\pydantic\validate_call_decorator.py", line 59, in wrapper_function
    return validate_call_wrapper(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\91707\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-Q2UNHawR-py3.12\Lib\site-packages\pydantic\_internal\_validate_call.py", line 81, in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\91707\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-Q2UNHawR-py3.12\Lib\site-packages\tremendous\api\tremendous_api.py", line 1785, in create_order
    _param = self._create_order_serialize(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\91707\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-Q2UNHawR-py3.12\Lib\site-packages\tremendous\api\tremendous_api.py", line 2014, in _create_order_serialize
    return self.api_client.param_serialize(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\91707\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-Q2UNHawR-py3.12\Lib\site-packages\tremendous\api_client.py", line 226, in param_serialize
    body = self.sanitize_for_serialization(body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\91707\AppData\Local\pypoetry\Cache\virtualenvs\fastapi-template-Q2UNHawR-py3.12\Lib\site-packages\tremendous\api_client.py", line 373, in sanitize_for_serialization
    for key, val in obj_dict.items()
                    ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'items'
lucasmazza commented 15 hours ago

I merged #19 to fix this and will work on updating our docs and release a new version with the changes

lucasmazza commented 13 hours ago

v4.0.0 is out with the fix