Skip to content

Commit fb797f9

Browse files
authored
Corrected a problem fetching datasets with type 1 authentication. (#1292)
1 parent 14f61cd commit fb797f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

functions-python/helpers/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,11 @@ def download_and_get_hash(
107107
"AppleWebKit/537.36 (KHTML, like Gecko) "
108108
"Chrome/126.0.0.0 Mobile Safari/537.36"
109109
}
110+
# Careful, some URLs may already contain a query string
111+
# (e.g. http://api.511.org/transit/datafeeds?operator_id=CE)
110112
if authentication_type == 1 and api_key_parameter_name and credentials:
111-
url += f"?{api_key_parameter_name}={credentials}"
113+
separator = "&" if "?" in url else "?"
114+
url += f"{separator}{api_key_parameter_name}={credentials}"
112115

113116
# authentication_type == 2 -> the credentials are passed in the header
114117
if authentication_type == 2 and api_key_parameter_name and credentials:

0 commit comments

Comments
 (0)