Registry / http-networking / overpy

overpy

JSON →
library0.7pypypi✓ verified 83d ago

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.

pip install overpy
INSTALL
IMPORT
SIG · OVERPY
O
overpy
http-networkingpythonv0.7
Install
1.6s avg
Import
165ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.174s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.156s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Overpass
from overpy import Overpass
OverpassException
from overpy import OverpassException

Initialize Overpass API, run a query, and iterate over results.

import overpy api = overpy.Overpass() result = api.query(""" node(50.745,7.17,50.75,7.18)["amenity"="restaurant"]; out body; """) for node in result.nodes: print(f"Node ID: {node.id}, Tags: {node.tags}")
Debug
Known issues
gotchaThe Overpass API has rate limits and usage policies. Overpy does not handle retries; you must handle HTTP errors and API errors yourself.
fix
Wrap queries in try/except blocks and implement exponential backoff for retries.
affects: all
gotchaThe default user agent is old and may be blocked. Some Overpass instances (e.g., overpass-api.de) require a custom user agent.
fix
Set a custom user agent: Overpass(user_agent='YourApp/1.0')
affects: all
deprecatedThe old 'Overpass(url="http://overpass-api.de/api/interpreter")' pattern without explicit user agent is discouraged.
fix
Use Overpass(user_agent='YourApp/1.0')
affects: <0.7
Errors
Common errors & fixes
overpy.exception.OverpassException: Error 429 Too Many Requests
Request rate limited by Overpass server.
fix
Add delays between queries (e.g., time.sleep(10)) or use a more generous rate limit.
TypeError: 'Node' object is not subscriptable
Using index notation on a Node result instead of .tags dictionary.
fix
Access tags via node.tags['key'] or node.tags.get('key')
AttributeError: 'NoneType' object has no attribute 'tags'
Result element is None because the query returned no data.
fix
Check if result is None before accessing attributes, or handle in try/except.
Upgrade
Version history
0.7latest on PyPI · released Dec 4, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
overpy — pip install overpy · libregistry