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

Duplicate semicolon inserted when query ends in semicolon and whitespace #101

Closed
@torfsen

Description

@torfsen

If my query string ends in a semicolon plus some whitespace then overpass adds an additional semicolon before adding the out statement. This results in a syntax error:

In [20]: api.get('node["name"="Berlin"]; ')
---------------------------------------------------------------------------
OverpassSyntaxError                       Traceback (most recent call last)
<ipython-input-20-447b86aa8161> in <module>()
----> 1 api.get('node["name"="Berlin"]; ')

~/projects/reduced-maps/venv/lib/python3.5/site-packages/overpass/api.py in get(self, query, responseformat, verbosity, build)
     64 
     65         # Get the response from Overpass
---> 66         r = self._get_from_overpass(full_query)
     67         content_type = r.headers.get('content-type')
     68 

~/projects/reduced-maps/venv/lib/python3.5/site-packages/overpass/api.py in _get_from_overpass(self, query)
    144         if self._status != 200:
    145             if self._status == 400:
--> 146                 raise OverpassSyntaxError(query)
    147             elif self._status == 429:
    148                 raise MultipleRequestsError()

OverpassSyntaxError: [out:json];node["name"="Berlin"]; ;out body;

Removing the whitespace fixes this, but it would be nice if overpass would do that automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions