thingsboard-python-rest-client icon indicating copy to clipboard operation
thingsboard-python-rest-client copied to clipboard

TypeError: Got an unexpected keyword argument 'type' to method get_customer_device_infos_using_get

Open soelgary opened this issue 1 year ago • 0 comments

Hey folks,

I found a bug when trying to list all the devices for my customer. The get_customer_device_infos is passing the type kwarg to get_customer_device_infos_using_get. But get_customer_device_infos_using_get doesn't support type.

Heres a working example:

url = "https://thingsboard.cloud"
username = "..."
password = "..."
customer_id = "..."

with RestClientPE(url) as rest_client:
    rest_client.login(username, password)
    devices = rest_client.get_customer_device_infos(
        customer_id=customer_id,
        page_size=100,
        page=0,
    )

Full stack trace:

Traceback (most recent call last):
  File "/Users/garysoeller/dev/src3/mason-web/manage.py", line 22, in <module>
    main()
  File "/Users/garysoeller/dev/src3/mason-web/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/Users/garysoeller/Library/Caches/pypoetry/virtualenvs/mason-web-tvi22vCl-py3.12/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/Users/garysoeller/Library/Caches/pypoetry/virtualenvs/mason-web-tvi22vCl-py3.12/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/garysoeller/Library/Caches/pypoetry/virtualenvs/mason-web-tvi22vCl-py3.12/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/garysoeller/Library/Caches/pypoetry/virtualenvs/mason-web-tvi22vCl-py3.12/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/garysoeller/dev/src3/mason-web/core/management/commands/tb.py", line 16, in handle
    devices = rest_client.get_customer_device_infos(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/garysoeller/Library/Caches/pypoetry/virtualenvs/mason-web-tvi22vCl-py3.12/lib/python3.12/site-packages/tb_rest_client/rest_client_pe.py", line 1621, in get_customer_device_infos
    return self.device_controller.get_customer_device_infos_using_get(customer_id=customer_id, page_size=page_size,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/garysoeller/Library/Caches/pypoetry/virtualenvs/mason-web-tvi22vCl-py3.12/lib/python3.12/site-packages/tb_rest_client/api/api_pe/device_controller_api.py", line 817, in get_customer_device_infos_using_get
    (data) = self.get_customer_device_infos_using_get_with_http_info(customer_id, page_size, page, **kwargs)  # noqa: E501
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/garysoeller/Library/Caches/pypoetry/virtualenvs/mason-web-tvi22vCl-py3.12/lib/python3.12/site-packages/tb_rest_client/api/api_pe/device_controller_api.py", line 853, in get_customer_device_infos_using_get_with_http_info
    raise TypeError(
TypeError: Got an unexpected keyword argument 'type' to method get_customer_device_infos_using_get

I'm using version 3.7.0

soelgary avatar Sep 05 '24 23:09 soelgary