scaleway / scaleway-sdk-python

Integrate Scaleway with your Python applications
Apache License 2.0
24 stars 8 forks source link

InstanceV1API list_servers raises an exception for any query because it does not instantiate ServerIp correctly #572

Open cdonadeo opened 4 months ago

cdonadeo commented 4 months ago

Example:

from scaleway import Client
from scaleway.instance.v1 import InstanceV1API

client = Client(
  access_key=SCW_ACCESS_KEY_ID,
  secret_key=SCW_SECRET_KEY,
  default_project_id=SCW_PROJECT_ID,
  default_region='fr-par',
  default_zone='fr-par-1',
  default_page_size=100
)

api = InstanceV1API(client)
result = api.list_servers()
print('Got %i results' % len(result))

Result:

$ python example.py
Traceback (most recent call last):
  File "/Users/jcd/Repos/iplistgen/example.py", line 18, in <module>
    result = api.list_servers()
             ^^^^^^^^^^^^^^^^^^
  File "/Users/jcd/Library/Caches/pypoetry/virtualenvs/iplistgen-gpgcOG1k-py3.12/lib/python3.12/site-packages/scaleway/instance/v1/api.py", line 435, in list_servers
    return unmarshal_ListServersResponse(res.json())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jcd/Library/Caches/pypoetry/virtualenvs/iplistgen-gpgcOG1k-py3.12/lib/python3.12/site-packages/scaleway/instance/v1/marshalling.py", line 2018, in unmarshal_ListServersResponse
    [unmarshal_Server(v) for v in field] if field is not None else None
     ^^^^^^^^^^^^^^^^^^^
  File "/Users/jcd/Library/Caches/pypoetry/virtualenvs/iplistgen-gpgcOG1k-py3.12/lib/python3.12/site-packages/scaleway/instance/v1/marshalling.py", line 798, in unmarshal_Server
    args["public_ip"] = unmarshal_ServerIp(field)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jcd/Library/Caches/pypoetry/virtualenvs/iplistgen-gpgcOG1k-py3.12/lib/python3.12/site-packages/scaleway/instance/v1/marshalling.py", line 565, in unmarshal_ServerIp
    return ServerIp(**args)
           ^^^^^^^^^^^^^^^^
TypeError: ServerIp.__init__() missing 2 required positional arguments: 'gateway' and 'ipam_id'
Laure-di commented 4 months ago

Hello,

Could you please provide more information about your issue? To help us better understand, you can add the following code to enable logging:

import logging

logger = logging.getLogger("scaleway") logger.addHandler(logging.StreamHandler()) logger.setLevel(logging.DEBUG) This will generate logs that you can share with us for further analysis.

Thank you!