InfraNode with Python: the infranode package
Tutorial: fetch open data for German cities with the keyless Python package infranode, sync and async, plus ready-made LangChain and LlamaIndex tools for AI agents.
Install
pip install infranode First request
One instance, then any endpoint via a method or the generic
record(slug, endpoint). The data lives under
payload, the source under attribution.
from infranode import InfraNode
api = InfraNode()
rec = api.weather("berlin")
print(rec.payload["temperature_c"], "degC")
print("Source:", rec.attribution["text"]) # always show attribution
# Any endpoint by name
fuel = api.record("hamburg", "fuel-prices")
cities = api.cities() # all 84 cities
Every record carries its own attribution (source and license
URL). The open-data licenses require attribution, so display it to your
users.
Async
For many parallel requests or asyncio apps:
import asyncio
from infranode import AsyncInfraNode
async def main():
async with AsyncInfraNode() as api:
rec = await api.air("muenchen")
print(rec.payload)
asyncio.run(main()) Mind the rate limit of 300 requests per minute per IP; back off on 429.
As an AI agent tool: LangChain
pip install "infranode[langchain]" from infranode.integrations.langchain import infranode_tools
tools = infranode_tools() # bind these to your LangChain agent As an AI agent tool: LlamaIndex
pip install "infranode[llamaindex]" from infranode.integrations.llamaindex import infranode_tools
tools = infranode_tools() # pass to your LlamaIndex agent
Both expose infranode_get_city_data(city, dataset) and
infranode_list_cities(). The tool description lists valid
datasets so the model picks the right one. If your runtime speaks MCP, use
the InfraNode MCP server.
Learn more
Source and issues: github.com/street1983nk/infranode-python. For plain notebook analysis without the package, see City data with Python and pandas.
FAQ
- Do I need an API key?
- No. The package talks to the keyless, free InfraNode API. No key, no signup.
- Sync or async?
- Both. InfraNode is the synchronous client, AsyncInfraNode the asynchronous one. They share the same method API.
- How is this different from the MCP server?
- The MCP server is ideal when your runtime speaks MCP (Claude, Cursor). The Python package is the lightweight, MCP-free path for scripts, notebooks and LangChain/LlamaIndex agents.