linode-api4 -How do I get access to individual fields into client.linode.types()?

Hi,
I would like to ask how to get access to fields values into types client. I've done:
types = client.linode.types()

and got a print of the first type doing:
pp.pprint(vars(types[0]))

And the output is:
{'_client': <linode_api4.linode_client.linodeclient 0x0000015aa5516c10="" at="" object="">,
'_last_updated': datetime.datetime(2022, 5, 6, 15, 37, 13, 67033),
'_populated': True,
'_raw_json': {'addons': {'backups': {'price': {'hourly': 0.003,
'monthly': 2.0}}},
'class': 'nanode',
'disk': 25600,
'gpus': 0,
'id': 'g6-nanode-1',
'label': 'Nanode 1GB',
'memory': 1024,
'network_out': 1000,
'price': {'hourly': 0.0075, 'monthly': 5.0},
'successor': None,
'transfer': 1000,
'vcpus': 1},
'addons': Mapping containing dict_keys(['backups']),
'disk': 25600,
'gpus': 0,
'id': 'g6-nanode-1',
'label': 'Nanode 1GB',
'memory': 1024,
'network_out': 1000,
'price': Mapping containing dict_keys(['hourly', 'monthly']),
'transfer': 1000,
'type_class': 'nanode',
'vcpus': 1}</linode_api4.linode_client.linodeclient>

But how do I address each of the fields into this output? It seems a dictio, but I've tried
pp.pprint(vars(types[0]['type_class'])) #and the same with other keys

and I get:
TypeError: 'Type' object is not subscriptable

Thanks in advance.

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct