{"id":23970,"library":"linode-metadata","title":"Linode Metadata Python Client","description":"A client to interact with the Linode Metadata service in Python. Provides methods to query instance metadata (like IP addresses, SSH keys, user data) and user-defined metadata. Current version 0.3.5, requires Python >=3.9.","status":"active","version":"0.3.5","language":"python","source_language":"en","source_url":"https://github.com/linode/linode-metadata-py","tags":["linode","metadata","cloud","api-client"],"install":[{"cmd":"pip install linode-metadata","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for HTTP requests to the metadata endpoint.","package":"httpx","optional":false}],"imports":[{"note":"Direct import of the class is the standard pattern; importing the module requires using linode_metadata.LinodeMetadata.","wrong":"import linode_metadata","symbol":"LinodeMetadata","correct":"from linode_metadata import LinodeMetadata"}],"quickstart":{"code":"from linode_metadata import LinodeMetadata\n\n# Instantiate the client\nclient = LinodeMetadata()\n\n# Get network information\nnetwork = client.get_network()\nprint(network)\n\n# Get SSH keys\nssh_keys = client.get_ssh_keys()\nprint(ssh_keys)\n\n# Get user data (if any)\nuser_data = client.get_user_data()\nprint(user_data)","lang":"python","description":"Basic usage showing how to instantiate the client and fetch common metadata types."},"warnings":[{"fix":"Only use this library on a Linode compute instance.","message":"The client uses the Linode Metadata service which is only available from within a Linode instance. Running code outside of a Linode will cause connection errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Migrate to the specific getter methods.","message":"The 'get_metadata' method was deprecated in favor of specific methods like get_network(), get_ssh_keys(), get_user_data().","severity":"deprecated","affected_versions":"<0.3.0"},{"fix":"Upgrade Python to 3.9 or later.","message":"Drop of support for Python 3.6 and 3.7. Requires Python >=3.9.","severity":"breaking","affected_versions":">=0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure you are running the code on a Linode instance, or wrap the call in a try-except for offline testing.","cause":"The library tries to connect to the Linode Metadata endpoint (169.254.169.254) which only exists on Linode instances.","error":"httpx.ConnectError: [Errno -2] Name or service not known"},{"fix":"Use attribute access instead of dictionary indexing, e.g., net.public_ipv4 instead of net['public_ipv4'].","cause":"Accessing dictionary keys directly when get_network() returns an object instead of a dict in newer versions.","error":"KeyError: 'network'"},{"fix":"Use the specific methods: get_network(), get_ssh_keys(), get_user_data(), etc.","cause":"The method get_metadata() was removed in version 0.3.0.","error":"AttributeError: 'LinodeMetadata' object has no attribute 'get_metadata'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}