Skip to content

Commit 162819c

Browse files
author
Evan Derickson
committed
Invert conditional, fix typo, update readme
1 parent 93afe66 commit 162819c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ response = api.get('node["name"="Salt Lake City"]')
5656

5757
`response` will be a dictionary representing the
5858
JSON output you would get [from the Overpass API
59-
directly](https://overpass-api.de/output_formats.html#json).
59+
directly](https://overpass-api.de/output_formats.html#json).
6060

6161
**Note that the Overpass query passed to `get()` should not contain any `out` or other meta statements.** See `verbosity` below for how to control the output.
6262

@@ -98,7 +98,11 @@ response = api.get('node["name"="Salt Lake City"]', responseformat="xml")
9898

9999
We will construct a valid Overpass QL query from the parameters you set by default. This means you don't have to include 'meta' statements like `[out:json]`, `[timeout:60]`, `[out body]`, etcetera. You just supply the meat of the query, the part that actually tells Overpass what to query for. If for whatever reason you want to override this and supply a full, valid Overpass QL query, you can set `build` to `False` to make the API not do any pre-processing.
100100

101-
### Pre-cooked Queries: `MapQuery`, `WayQuery`
101+
#### `date`
102+
103+
You can query the data as it was on a given date. You can give either a standard ISO date alone (YYYY-MM-DD) or a full overpass date and time (YYYY-MM-DDTHH:MM:SSZ, i.e. 2020-04-28T00:00:00Z).
104+
105+
### Pre-cooked Queries: `MapQuery`, `WayQuery`
102106

103107
In addition to just sending your query and parse the result, `overpass`
104108
provides shortcuts for often used map queries. To use them, just pass

overpass/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ def get(self, query, responseformat="geojson", verbosity="body", build=True, dat
8484
or allow the programmer to specify full query manually (False)
8585
:param date: a date with an optional time. Example: 2020-04-27 or 2020-04-27T00:00:00Z
8686
"""
87-
if date and not isinstance(date, datetime):
87+
if date and isinstance(date, str):
8888
# If date is given and is not already a datetime, attempt to parse from string
8989
try:
9090
date = datetime.fromisoformat(date)
9191
except ValueError:
92-
# The 'Z' in a standard overpass date will through fromisoformat() off
92+
# The 'Z' in a standard overpass date will throw fromisoformat() off
9393
date = datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ')
9494
# Construct full Overpass query
9595
if build:

0 commit comments

Comments
 (0)