How to use the osmium.replication.server function in osmium

To help you get started, we’ve selected a few osmium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstreetmap / Nominatim / utils / check_server_for_updates.py View on Github external
#!/usr/bin/env python3

import sys
from osmium.replication import server

if __name__ == '__main__':
    if len(sys.argv) != 3:
        print("Usage: python check_server_for_updates.py  ")
        sys.exit(254)

    seqid = int(sys.argv[2])

    state = server.ReplicationServer(sys.argv[1]).get_state_info()

    if state is None:
        print("ERROR: Cannot get state from URL %s." % (sys.argv[1], ))
        sys.exit(253)

    if state.sequence <= seqid:
        print("Database up to date.")
        sys.exit(1)

    print("New data available (%i => %i)." % (seqid, state.sequence))
    sys.exit(0)

osmium

Python bindings for libosmium, the data processing library for OSM data

BSD-2-Clause
Latest version published 5 months ago

Package Health Score

76 / 100
Full package analysis