Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Commit 01bcf44

Browse files
committed
Changing behaviour
1 parent a45480e commit 01bcf44

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

overpass/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class API(object):
1313
# defaults for the API class
1414
_timeout = 25 # seconds
1515
_endpoint = "http://overpass-api.de/api/interpreter"
16-
_debug = True
16+
_debug = False
1717

1818
_QUERY_TEMPLATE = "[out:{out}];{query}out {verbosity};"
1919
_GEOJSON_QUERY_TEMPLATE = "[out:json];{query}out body geom;"

overpass/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@
1212
help='URL of your prefered API.')
1313
@click.option('--responseformat', default='geojson', help="""Format to save the data.
1414
Options are 'geojson' and 'osm'. Default format is geojson.""")
15-
@click.option('-q', '--queryfile', type=click.File("r"))
15+
@click.option('-f', '--queryasfile', help="Pass a full query as a file (useful for multiline queries).",
16+
is_flag=True)
1617
@click.argument('query', type=str)
17-
def cli(timeout, endpoint, responseformat, query, queryfile):
18+
def cli(timeout, endpoint, responseformat, query, queryasfile):
1819
"""Run query"""
1920
api = overpass.API(timeout=timeout, endpoint=endpoint)
2021
if responseformat not in api.SUPPORTED_FORMATS:
2122
print("format {} not supported. Supported formats: {}".format(
2223
responseformat,
2324
", ".join(api.SUPPORTED_FORMATS)))
2425
sys.exit(1)
25-
if queryfile:
26+
if queryasfile:
27+
queryfile = click.open_file(query, "r")
2628
query = queryfile.read()
27-
result = api.Get(query, responseformat=responseformat, build=not bool(queryfile))
29+
result = api.Get(query, responseformat=responseformat, build=not bool(queryasfile))
2830
click.echo(result)

0 commit comments

Comments
 (0)