azure python sdk 方法中的 custom_headers 是什么?

What is custom_headers in azure python sdk methods?

我正在尝试查找附加到 运行 Azure VM 的 public IP 地址。

我已经根据 尝试了两个答案,但我没有得到所需的输出。 正在获取 Public IP:None

    ...:     for interface in vm.network_profile.network_interfaces:
    ...:         name=" ".join(interface.id.split('/')[-1:])
    ...:         print (name)
    ...:         sub="".join(interface.id.split('/')[4])
    ...:         print (sub)
    ...:         thing = network_client.network_interfaces.get(sub, name).ip_configurations
    ...:         for x in thing:
    ...:             print (x.public_ip_address)
    ...:
xxx
xxx
{'additional_properties': {}, 'id': '/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Network/publicIPAddresses/Test-ip', 'name': None, 'type': None, 'location': None, 'tags': None, 'sku': None, 'public_ip_allocation_method': None, 'public_ip_address_version': None, 'ip_configuration': None, 'dns_settings': None, 'ddos_settings': None, 'ip_tags': None, 'ip_address': None, 'public_ip_prefix': None, 'idle_timeout_in_minutes': None, 'resource_guid': None, 'provisioning_state': None, 'etag': None, 'zones': None}

而使用 network_client 我得到输出

In [6]: from azure.mgmt.network import NetworkManagementClient
In [21]: for i in network_client.public_ip_addresses.list("xxx"):
    ...:     print (i)

但在这里我得到了所有订阅的输出,基本上我想过滤的所有资源组。 因此,我认为使用 custom_headers 我们可以过滤,但我没有得到我为 custom_headers.

创建的 dict 的确切命名约定。

简短版:您的问题已在 Github 上得到解决: https://github.com/Azure/azure-sdk-for-python/issues/897

一些评论:

(我在 MS Python SDK 团队工作)