openvan 0.4.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openvan-0.4.0 → openvan-0.5.0}/PKG-INFO +7 -3
- {openvan-0.4.0 → openvan-0.5.0}/README.md +6 -2
- {openvan-0.4.0 → openvan-0.5.0}/src/openvan/api.py +30 -0
- {openvan-0.4.0 → openvan-0.5.0}/src/openvan/client.py +1 -1
- {openvan-0.4.0 → openvan-0.5.0}/tests/test_openvan.py +16 -0
- {openvan-0.4.0 → openvan-0.5.0}/.gitignore +0 -0
- {openvan-0.4.0 → openvan-0.5.0}/LICENSE +0 -0
- {openvan-0.4.0 → openvan-0.5.0}/pyproject.toml +0 -0
- {openvan-0.4.0 → openvan-0.5.0}/src/openvan/__init__.py +0 -0
- {openvan-0.4.0 → openvan-0.5.0}/src/openvan/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: openvan
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Free vanlife & RV travel data: fuel prices in 160+ countries, toll roads, visa rules, holidays, travel hazards, weather scores, currency. No API key.
|
|
5
5
|
Project-URL: Homepage, https://openvan.camp/en/developers?utm_source=pypi&utm_medium=referral&utm_campaign=python-sdk
|
|
6
6
|
Project-URL: Documentation, https://openvan.camp/docs?utm_source=pypi&utm_medium=referral&utm_campaign=python-sdk
|
|
@@ -25,7 +25,7 @@ Description-Content-Type: text/markdown
|
|
|
25
25
|
# openvan — Python client for the OpenVan.camp API
|
|
26
26
|
|
|
27
27
|
Free vanlife & RV travel data in Python: whole-trip roadbooks, fuel prices in 170+ countries, toll roads, ferry
|
|
28
|
-
crossings and timetables, visa and vehicle-import rules, public and school holidays, travel hazards and wildfires, customs rules,
|
|
28
|
+
crossings and timetables, biting insects by place and month, visa and vehicle-import rules, public and school holidays, travel hazards and wildfires, customs rules,
|
|
29
29
|
power plugs, weather suitability scores, food cost index, currency rates, events, news and
|
|
30
30
|
license plates of the world.
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@ pip install openvan
|
|
|
40
40
|
```python
|
|
41
41
|
from openvan import OpenVan
|
|
42
42
|
|
|
43
|
-
ov = OpenVan(source="myapp.com") #
|
|
43
|
+
ov = OpenVan(source="myapp.com") # your site or app name; the default "openvan-python" does not identify you
|
|
44
44
|
|
|
45
45
|
# Cheapest diesel in the world right now, EUR per liter
|
|
46
46
|
for c in ov.fuel.cheapest("diesel", 5):
|
|
@@ -72,6 +72,10 @@ ov.holidays.country("DE", from_="2026-10-01", to="2026-12-31", kind="school")
|
|
|
72
72
|
lines = [f["properties"] for f in ov.ferries.window((8, 38, 16, 42), zoom=6)["features"] if f["properties"]["kind"] == "route"]
|
|
73
73
|
print(ov.ferries.schedule("r5958961")["directions"][0]["next"])
|
|
74
74
|
|
|
75
|
+
# Who bites near Kiruna in July (Bug Season): level 0-3 for the month; None = not studied
|
|
76
|
+
for g in ov.bites.place(67.85, 20.22, date="2027-07-10")["groups"]:
|
|
77
|
+
print(g["name"], g["level"], g["status"])
|
|
78
|
+
|
|
75
79
|
# A whole trip plan: route, days, budget and rules for every country (waits up to 60 s)
|
|
76
80
|
trip = ov.roadbook.plan(["Munich", "Venice"], inputs={"travelers": ["DE"]})
|
|
77
81
|
print("https://openvan.camp" + trip["url"])
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# openvan — Python client for the OpenVan.camp API
|
|
2
2
|
|
|
3
3
|
Free vanlife & RV travel data in Python: whole-trip roadbooks, fuel prices in 170+ countries, toll roads, ferry
|
|
4
|
-
crossings and timetables, visa and vehicle-import rules, public and school holidays, travel hazards and wildfires, customs rules,
|
|
4
|
+
crossings and timetables, biting insects by place and month, visa and vehicle-import rules, public and school holidays, travel hazards and wildfires, customs rules,
|
|
5
5
|
power plugs, weather suitability scores, food cost index, currency rates, events, news and
|
|
6
6
|
license plates of the world.
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ pip install openvan
|
|
|
16
16
|
```python
|
|
17
17
|
from openvan import OpenVan
|
|
18
18
|
|
|
19
|
-
ov = OpenVan(source="myapp.com") #
|
|
19
|
+
ov = OpenVan(source="myapp.com") # your site or app name; the default "openvan-python" does not identify you
|
|
20
20
|
|
|
21
21
|
# Cheapest diesel in the world right now, EUR per liter
|
|
22
22
|
for c in ov.fuel.cheapest("diesel", 5):
|
|
@@ -48,6 +48,10 @@ ov.holidays.country("DE", from_="2026-10-01", to="2026-12-31", kind="school")
|
|
|
48
48
|
lines = [f["properties"] for f in ov.ferries.window((8, 38, 16, 42), zoom=6)["features"] if f["properties"]["kind"] == "route"]
|
|
49
49
|
print(ov.ferries.schedule("r5958961")["directions"][0]["next"])
|
|
50
50
|
|
|
51
|
+
# Who bites near Kiruna in July (Bug Season): level 0-3 for the month; None = not studied
|
|
52
|
+
for g in ov.bites.place(67.85, 20.22, date="2027-07-10")["groups"]:
|
|
53
|
+
print(g["name"], g["level"], g["status"])
|
|
54
|
+
|
|
51
55
|
# A whole trip plan: route, days, budget and rules for every country (waits up to 60 s)
|
|
52
56
|
trip = ov.roadbook.plan(["Munich", "Venice"], inputs={"travelers": ["DE"]})
|
|
53
57
|
print("https://openvan.camp" + trip["url"])
|
|
@@ -49,6 +49,7 @@ class OpenVan:
|
|
|
49
49
|
self.customs = Customs(self.client)
|
|
50
50
|
self.roadbook = Roadbook(self.client)
|
|
51
51
|
self.ferries = Ferries(self.client)
|
|
52
|
+
self.bites = Bites(self.client)
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
class _Resource:
|
|
@@ -431,3 +432,32 @@ class Ferries(_Resource):
|
|
|
431
432
|
``available: False`` means no open timetable is matched, not that the ferry does not run.
|
|
432
433
|
"""
|
|
433
434
|
return self.client.get(f"/api/ferries/{quote(id)}/schedule")
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
class Bites(_Resource):
|
|
438
|
+
"""Bug Season: biting, stinging and burning insects by place and month.
|
|
439
|
+
|
|
440
|
+
``level`` is 0 none, 1 tolerable, 2 many, 3 unbearable. ``None`` means "not studied", never
|
|
441
|
+
"no insects"; a group in ``hidden`` is not confirmed at that place, which is not "absent".
|
|
442
|
+
"""
|
|
443
|
+
|
|
444
|
+
def groups(self, locale: Optional[str] = None) -> JSON:
|
|
445
|
+
"""The 18 groups (name, taxon, when they bite, icon) and ``definitions`` of every level and field."""
|
|
446
|
+
return self.client.get("/api/bites/groups", {"locale": locale})
|
|
447
|
+
|
|
448
|
+
def place(self, lat: float, lng: float, date: Optional[str] = None, locale: Optional[str] = None) -> JSON:
|
|
449
|
+
"""Groups at a point, worst first, with the level for the month of ``date`` (YYYY-MM-DD) and all 12 months."""
|
|
450
|
+
return self.client.get("/api/bites/place", {"lat": lat, "lng": lng, "date": date, "locale": locale})
|
|
451
|
+
|
|
452
|
+
def route(self, stops: Sequence[Tuple[Any, ...]], locale: Optional[str] = None) -> JSON:
|
|
453
|
+
"""Up to 25 stops as ``(lat, lng)`` or ``(lat, lng, "YYYY-MM-DD")``. 30 requests per minute."""
|
|
454
|
+
encoded = "|".join(",".join(str(v) for v in stop) for stop in stops)
|
|
455
|
+
return self.client.get("/api/bites/route", {"stops": encoded, "locale": locale})
|
|
456
|
+
|
|
457
|
+
def country(self, code: str, locale: Optional[str] = None) -> JSON:
|
|
458
|
+
"""Season of every group in a country and each of its regions (status, 12 monthly levels)."""
|
|
459
|
+
return self.client.get(f"/api/bites/countries/{code.upper()}", {"locale": locale})
|
|
460
|
+
|
|
461
|
+
def coverage(self) -> JSON:
|
|
462
|
+
"""What is studied: per country, how many region × group pairs are in each status."""
|
|
463
|
+
return self.client.get("/api/bites/coverage")
|
|
@@ -165,6 +165,20 @@ class OpenVanTest(unittest.TestCase):
|
|
|
165
165
|
with mock.patch("openvan.client.urlopen", fake):
|
|
166
166
|
self.assertFalse(OpenVan().ferries.schedule("r5958961")["available"])
|
|
167
167
|
|
|
168
|
+
def test_bites_route_encodes_stops(self):
|
|
169
|
+
fake, calls = respond({"/api/bites/route": {"stops": []}})
|
|
170
|
+
with mock.patch("openvan.client.urlopen", fake):
|
|
171
|
+
OpenVan().bites.route([(48.708, 44.513, "2027-06-10"), (43.21, 27.91)])
|
|
172
|
+
query = parse_qs(urlparse(calls[0].full_url).query)
|
|
173
|
+
self.assertEqual(query["stops"], ["48.708,44.513,2027-06-10|43.21,27.91"])
|
|
174
|
+
|
|
175
|
+
def test_bites_place_passes_date(self):
|
|
176
|
+
fake, calls = respond({"/api/bites/place": {"groups": []}})
|
|
177
|
+
with mock.patch("openvan.client.urlopen", fake):
|
|
178
|
+
OpenVan().bites.place(48.708, 44.513, date="2027-06-10")
|
|
179
|
+
query = parse_qs(urlparse(calls[0].full_url).query)
|
|
180
|
+
self.assertEqual((query["lat"], query["date"]), (["48.708"], ["2027-06-10"]))
|
|
181
|
+
|
|
168
182
|
def test_roadbook_plan_polls_until_ready(self):
|
|
169
183
|
fake, calls = respond({
|
|
170
184
|
"/api/roadbook/from-places": {"code": "abc12", "status": "building", "url": "/en/roadbook/abc12"},
|
|
@@ -212,6 +226,8 @@ class LiveSmokeTest(unittest.TestCase):
|
|
|
212
226
|
self.assertIn("items", ov.customs.country("TR", from_country="DE"))
|
|
213
227
|
self.assertIn("features", ov.ferries.window((4.9, 58.8, 6.2, 59.4), zoom=9))
|
|
214
228
|
self.assertIn("available", ov.ferries.schedule("r5958961"))
|
|
229
|
+
self.assertIn("groups", ov.bites.place(48.708, 44.513, date="2027-06-10"))
|
|
230
|
+
self.assertIn("definitions", ov.bites.groups())
|
|
215
231
|
|
|
216
232
|
|
|
217
233
|
if __name__ == "__main__":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|