InstanceV1API list_servers raises an exception for any query because it does not instantiate ServerIp correctly
- Python 3.12.4
- scaleway 2.4.1
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'
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!
I had the same problem when upgrading from v1.8.0 to v2.7.0.
Please give us a workaround !
My error is: Exception has occurred: TypeError ServerIp.init() missing 2 required positional arguments: 'gateway' and 'ipam_id'
Hello,
The issue has been raised to the product team. We apologize for the inconvenience and the delay.
Thank you for reporting this and for your patience.
Laure
Hello @FrPellissier @cdonadeo,
This bug could occur if an IP was NATed. Now that there is no longer a NAT IP, this problem should no longer occur.
Can you confirm if the bug still exists on your side?