ValueError: Invalid value for `dhcp`, must not be `None`

Open Beginner friendly
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start by reading the generated project_settings.py model and the deserialization path shown in the traceback for v1_get_project. Compare the dhcp handling with SDK version 0.3.2 and reproduce the request with the supplied example. Done means a project response with settings.dhcp set to None deserializes without raising this ValueError.

Written by the indexing model from the issue text.

Description

Description

Corellium SDK version installed via pip: corellium-api>=0.4.0

When using any version of the SDK >= 0.4.0, a regression in the v1_get_project occurs.

This is my code that is reproducing the error:

from __future__ import print_function

import asyncio
import corellium_api
from corellium_api.rest import ApiException

HOST = "https://***.corellium.com/api" # redacted

configuration = corellium_api.Configuration(host=HOST)
configuration.access_token = "***" # redacted


async def main():
    async with corellium_api.ApiClient(configuration) as api_client:
        client = corellium_api.CorelliumApi(api_client)

        project = await client.v1_get_project(
            project_id="<project-id>"
        )
        print(project)


if __name__ == "__main__":
    asyncio.run(main())

When running the code above, this produces a ValueError:

Traceback (most recent call last):
  File "PythonVenvs/corellium-sdk/main.py", line 35, in <module>
    asyncio.run(main())
  File "/opt/homebrew/Cellar/python@3.11/3.11.15_3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.15_3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.15_3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/main.py", line 25, in main
    project = await client.v1_get_project(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/api_client.py", line 214, in __call_api
    return_data = self.deserialize(response_data, response_type)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/api_client.py", line 286, in deserialize
    return self.__deserialize(data, response_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/api_client.py", line 325, in __deserialize
    return self.__deserialize_model(data, klass)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/api_client.py", line 693, in __deserialize_model
    kwargs[attr] = self.__deserialize(value, attr_type)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/api_client.py", line 325, in __deserialize
    return self.__deserialize_model(data, klass)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/api_client.py", line 695, in __deserialize_model
    instance = klass(**kwargs)
               ^^^^^^^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/models/project_settings.py", line 63, in __init__
    self.dhcp = dhcp
    ^^^^^^^^^
  File "PythonVenvs/corellium-sdk/venv/lib/python3.11/site-packages/corellium_api/models/project_settings.py", line 134, in dhcp
    raise ValueError("Invalid value for `dhcp`, must not be `None`")  # noqa: E501
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid value for `dhcp`, must not be `None`

This doesn't appear to happen on the SDK version 0.3.2:

{'id': '<project-id>',
 'name': 'test-name',
 'quotas': {'cores': 6.0, 'instances': 15.0, 'ram': 36864.0},
 'quotas_used': {'cores': 0.0, 'gpu': 0.0, 'instances': 1.0, 'ram': 0.0},
 'settings': {'dhcp': None, 'internet_access': True, 'version': 1.0}}
Dominant language
Python
Stars
15
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from corellium/python-api-client

All issues in corellium/python-api-client

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.