Fixed a rare bug with locals() being changed during iteration
This commit is contained in:
parent
956c4c30ea
commit
19971e6e71
@ -64,7 +64,7 @@ def board_arrival(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) == "date":
|
||||
if val != None:
|
||||
if isinstance(val, datetime):
|
||||
|
@ -65,7 +65,7 @@ def board_departure(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) == "date":
|
||||
if val != None:
|
||||
if isinstance(val, datetime):
|
||||
|
@ -97,7 +97,7 @@ def him_search(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) in {"dateB", "dateE"}:
|
||||
if val != None:
|
||||
if isinstance(val, datetime):
|
||||
|
@ -55,7 +55,7 @@ def journey_detail(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) == "rtMode":
|
||||
if val != None:
|
||||
payload["rtMode"] = val.upper()
|
||||
|
@ -54,7 +54,7 @@ def stop_by_coords(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) == "stopType":
|
||||
if val != None:
|
||||
payload["type"] = val.upper()
|
||||
|
@ -65,7 +65,7 @@ def stop_by_name(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) == "inputString":
|
||||
if val != None:
|
||||
payload["input"] = val
|
||||
|
@ -201,7 +201,7 @@ def trip_find(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) == "date":
|
||||
if val != None:
|
||||
if isinstance(val, datetime):
|
||||
|
@ -87,7 +87,7 @@ def trip_recon(
|
||||
payload = {}
|
||||
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
|
||||
|
||||
for var, val in locals().items():
|
||||
for var, val in locals().copy().items():
|
||||
if str(var) == "date":
|
||||
if val != None:
|
||||
if isinstance(val, datetime):
|
||||
|
Loading…
Reference in New Issue
Block a user