Improve price extraction
This commit is contained in:
parent
65aab7b180
commit
1e9736608a
1 changed files with 6 additions and 5 deletions
11
main.py
11
main.py
|
|
@ -133,12 +133,13 @@ def json_extract(obj, key):
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
||||||
def extract_prices(bookings_dict: dict[Any, Any]) -> dict[Any, Any]:
|
def extract_prices(bookings_dict: list[dict[Any, Any]]) -> dict[Any, Any]:
|
||||||
# .result[].connections[].offers[].reservation.reservationSegments[].compartments[].objects
|
# .result[].connections[].offers[].reservation.reservationSegments[].compartments[].objects
|
||||||
for r in bookings_dict[0][0][0]["result"]:
|
for booking in bookings_dict:
|
||||||
for c in r["connections"]:
|
for r in booking["result"]:
|
||||||
for o in c["offers"]:
|
for c in r["connections"]:
|
||||||
print(o["name"])
|
for o in c["offers"]:
|
||||||
|
print(o["name"])
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue