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

Commit e83f2ff

Browse files
committed
Merge branch 'master' into next_slot_available
2 parents 7ffe983 + dc96611 commit e83f2ff

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

overpass/api.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,13 @@ def _api_status() -> dict:
150150

151151
available_re = re.compile(r'\d(?= slots? available)')
152152
available_slots = int(
153-
available_re.search(lines[3]).group()
154-
if available_re.search(lines[3])
155-
else 0
153+
next(
154+
(
155+
available_re.search(line).group()
156+
for line in lines
157+
if available_re.search(line)
158+
), 0
159+
)
156160
)
157161

158162
waiting_re = re.compile(r'(?<=Slot available after: )[\d\-TZ:]{20}')
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Connected as: 0123456789
2+
Current time: 2022-06-15T22:13:27Z
3+
Announced endpoint: lz4.overpass-api.de/api/
4+
Rate limit: 2
5+
2 slots available now.
6+
Currently running queries (pid, space limit, time limit, start time):

tests/test_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ def test_geojson_live():
9090
@pytest.mark.parametrize(
9191
"response,slots_available,slots_running,slots_waiting",
9292
[
93+
(
94+
Path("tests/overpass_status/no_slots_waiting_six_lines.txt"),
95+
2,
96+
(),
97+
()
98+
),
9399
(
94100
Path("tests/overpass_status/no_slots_waiting.txt"),
95101
2,

0 commit comments

Comments
 (0)