Open Christophoclese opened 1 year ago
Sorry for the slow response on this issue. While waiting on a fix an alternative to the view_api using the compute_api can be found at https://github.com/dsoper2/DEVWKS-2254/blob/main/src/clive_intersight_python.ipynb: import intersight.api.compute_api
api_instance = intersight.api.compute_api.ComputeApi(api_client)
server_query = api_instance.get_compute_physical_summary_list(count=True) print(server_query)
per_page = 50 query_select = "Name,Model,Serial" for i in range(0, server_query.count, per_page): page_query = api_instance.get_compute_physical_summary_list(top=per_page, skip=i, select=query_select) print(page_query)
Thanks for the suggestions @dsoper2!
I ended up implementing an alternate workaround by passing _preload_content=False
into get_view_server_list(). This disables the automatic serialization of JSON into objects.
import intersight
from intersight.api import view_api
page_size = 100
page_start = 0
server_list = []
records_available = 0
# Initialize the View API client
view_api_instance = view_api.ViewApi(self.intersight_client)
# Attempt to obtain information on servers in Intersight
while page_start <= records_available:
api_response = view_api_instance.get_view_server_list(
_preload_content=False,
top=page_size,
skip=page_start,
)
intersight_data = json.loads(api_response.read())
server_list += intersight_data['Results']
page_start += page_size
records_available = intersight_data['Count']
Hi, I am getting an ApiValueError when attempting to retrieve a list of our server assets. I'm not sure if this is something I'm doing wrong. This is using version 1.0.11.9235 of the module.
Code:
Traceback: