当我尝试获取客户帐户的虚拟客户机的标记时,API返回内部服务器错误。
使用SoftLayer API库的代码示例:
api = SoftLayer.Client(username=customer_id, api_key=customer_apikey)
api['Account'].getVirtualGuests(mask='fullyQualifiedDomainName,tagReferences.tag.name')
例外是:
File "scripts/getting_tags.py", line 16, in <module>
for item in func(mask='fullyQualifiedDomainName,tagReferences.tag.name'):
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/API.py", line 362, in call_handler
return self(name, *args, **kwargs)
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/API.py", line 330, in call
return self.client.call(self.name, name, *args, **kwargs)
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/API.py", line 226, in call
return self.transport(request)
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/transports.py", line 162, in __call__
raise exceptions.TransportError(ex.response.status_code, str(ex))
SoftLayer.exceptions.TransportError: TransportError(500): 500 Server Error: Internal Server Error
几个月前,API调用正常运行。当我对硬件执行相同的调用(api ['Account']。getHardware)或从掩码中删除tagReferences时,它可以工作。
答案 0 :(得分:0)
它看起来像是一个错误,因为响应包含大量数据,试图在您的请求中添加限制:
api = SoftLayer.Client(username=customer_id, api_key=customer_apikey)
api['Account'].getVirtualGuests(mask='fullyQualifiedDomainName,tagReferences.tag.name',limit=10, offset=0)
有关限制的更多信息,请参阅:
http://softlayer-api-python-client.readthedocs.io/en/latest/api/client/
此致