{"id":24189,"library":"overpy","title":"Overpy - Overpass API Wrapper","description":"Overpy is a Python wrapper for the OpenStreetMap Overpass API, allowing querying of OSM data with Overpass QL. Current version is 0.7, requiring Python >=3.6. Release cadence is low; the library is in maintenance mode.","status":"active","version":"0.7","language":"python","source_language":"en","source_url":"https://github.com/DinoTools/python-overpy","tags":["openstreetmap","overpass-api","osm","python-wrapper"],"install":[{"cmd":"pip install overpy","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":null,"symbol":"Overpass","correct":"from overpy import Overpass"},{"note":"","wrong":null,"symbol":"OverpassException","correct":"from overpy import OverpassException"}],"quickstart":{"code":"import overpy\n\napi = overpy.Overpass()\nresult = api.query(\"\"\"\n    node(50.745,7.17,50.75,7.18)[\"amenity\"=\"restaurant\"];\n    out body;\n\"\"\")\nfor node in result.nodes:\n    print(f\"Node ID: {node.id}, Tags: {node.tags}\")","lang":"python","description":"Initialize Overpass API, run a query, and iterate over results."},"warnings":[{"fix":"Wrap queries in try/except blocks and implement exponential backoff for retries.","message":"The Overpass API has rate limits and usage policies. Overpy does not handle retries; you must handle HTTP errors and API errors yourself.","severity":"gotcha","affected_versions":"all"},{"fix":"Set a custom user agent: Overpass(user_agent='YourApp/1.0')","message":"The default user agent is old and may be blocked. Some Overpass instances (e.g., overpass-api.de) require a custom user agent.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Overpass(user_agent='YourApp/1.0')","message":"The old 'Overpass(url=\"http://overpass-api.de/api/interpreter\")' pattern without explicit user agent is discouraged.","severity":"deprecated","affected_versions":"<0.7"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add delays between queries (e.g., time.sleep(10)) or use a more generous rate limit.","cause":"Request rate limited by Overpass server.","error":"overpy.exception.OverpassException: Error 429 Too Many Requests"},{"fix":"Access tags via node.tags['key'] or node.tags.get('key')","cause":"Using index notation on a Node result instead of .tags dictionary.","error":"TypeError: 'Node' object is not subscriptable"},{"fix":"Check if result is None before accessing attributes, or handle in try/except.","cause":"Result element is None because the query returned no data.","error":"AttributeError: 'NoneType' object has no attribute 'tags'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}