Python・PowerShellとIntersight API8 / 10

Pythonでtenantの要求を組み立てる

Pythonの辞書でAPICの要求データを表現し、json.dumpsでJSON文字列へ変換できる。次はTenant-Labというtenantを表す要求本文の例である。

import json

tenant_name = "Tenant-Lab"
payload = {"fvTenant": {"attributes": {"name": tenant_name}}}
request_body = json.dumps(payload)
print(request_body)

📘 Pythonのモジュール

学習パスへ
参考資料