box / box-python-sdk-gen

Repository for generated Box Python SDK
Apache License 2.0
25 stars 5 forks source link

Updating collaboration to Owner raises AttributeError #288

Open majorgenson opened 2 weeks ago

majorgenson commented 2 weeks ago

Description of the Issue

Updating a Collaboration to the Owner role results in an unhandled AttributeError, despite the collaboration being successfully updated.

Steps to Reproduce

Create or get a Collaboration object and attempt to update the collaboration to the Owner role.

client.user_collaborations.update_collaboration_by_id(
    collaboration.id,
    UpdateCollaborationByIdRole.OWNER.value
)

Expected Behavior

I expected the operation to not raise an unhandled exception.

Error Message, Including Stack Trace

This results in the following traceback:

Traceback (most recent call last):
  File "/home/python/.local/lib/python3.9/site-packages/django/contrib/staticfiles/handlers.py", line 80, in __call__
    return self.application(environ, start_response)
  File "/home/python/.local/lib/python3.9/site-packages/wsgi_middleware/__init__.py", line 36, in __call__
    return self.application(environ, start_response)
  File "/home/python/.local/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 124, in __call__
    response = self.get_response(request)
  File "/home/python/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 140, in get_response
    response = self._middleware_chain(request)
  File "/home/python/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 57, in inner
    response = response_for_exception(request, exc)
  File "/home/python/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 140, in response_for_exception
    response = handle_uncaught_exception(
  File "/home/python/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 181, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/python/.local/lib/python3.9/site-packages/django_extensions/management/technical_response.py", line 40, in null_technical_500_response
    raise exc_value.with_traceback(tb)
  File "/home/python/.local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/home/python/.local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/python/.local/lib/python3.9/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/python/.local/lib/python3.9/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/python/.local/lib/python3.9/site-packages/django/views/generic/edit.py", line 153, in post
    return self.form_valid(form)
  File "/src/files/views.py", line 131, in form_valid
    client.user_collaborations.update_collaboration_by_id(
  File "/home/python/.local/lib/python3.9/site-packages/box_sdk_gen/managers/user_collaborations.py", line 278, in update_collaboration_by_id
    return deserialize(response.data, Collaboration)
  File "/home/python/.local/lib/python3.9/site-packages/box_sdk_gen/serialization/json/serializer.py", line 24, in deserialize
    return type.from_dict(value)
  File "/home/python/.local/lib/python3.9/site-packages/box_sdk_gen/internal/base_object.py", line 18, in from_dict
    for key, value in data.items():
AttributeError: 'NoneType' object has no attribute 'items'

It seems to be because updating a collaboration to Owner returns a 204 response with no content, data is None instead of a Python dict.

Screenshots

N/A

Versions Used

Python SDK: 1.3.0 Python: 3.9.19

congminh1254 commented 2 weeks ago

Hi @majorgenson

Thanks for your issue, we created a ticket and will address it soon.

Bests, Minh