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

未关闭 适合新手
#7 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
api

调研方向

首先阅读生成的 project_settings.py 模型,以及 v1_get_project 的 traceback 中显示的反序列化路径。将 dhcp 的处理与 SDK 0.3.2 版进行比较,并使用提供的示例复现请求。当 settings.dhcp 设置为 None 的项目响应能够在不引发此 ValueError 的情况下完成反序列化时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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}}
主要语言
Python
星标
15
派生
1
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

corellium/python-api-client 的其他 Issue

查看 corellium/python-api-client 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。