Skip to content

Commit f58c14d

Browse files
committed
differentiated 2 requests libraries
1 parent 51cf489 commit f58c14d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

functions-python/reverse_geolocation/src/reverse_geolocation_processor.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import flask
99
import pandas as pd
10-
import requests
10+
import requests as http_requests
1111
import shapely.geometry
1212
from geoalchemy2 import WKTElement
1313
from geoalchemy2.shape import to_shape
@@ -39,7 +39,7 @@
3939
from shared.helpers.logger import get_logger
4040

4141
from google.auth.transport import requests
42-
from google.auth import id_token
42+
from google.oauth2 import id_token
4343

4444

4545
@with_db_session
@@ -392,7 +392,8 @@ def extract_location_aggregates(
392392
token = id_token.fetch_id_token(auth_req, refresh_url)
393393

394394
# Make the HTTP request with the ID token
395-
response = requests.get(refresh_url, headers={"Authorization": f"Bearer {token}"})
395+
headers = {"Authorization": f"Bearer {token}"}
396+
response = http_requests.get(refresh_url, headers=headers)
396397

397398
response.raise_for_status()
398399
logger.info("Materialized view refresh event triggered successfully.")
@@ -494,13 +495,15 @@ def reverse_geolocation_process(
494495
overall_duration = (datetime.now() - overall_start).total_seconds()
495496
logger.info(f"Total time taken for the process: {overall_duration:.2f} seconds")
496497
logger.info(
497-
"COMPLETED. Processed %s stops for stable ID %s. Retrieved %s locations.",
498+
"COMPLETED. Processed %s stops for stable ID %s. "
499+
"Retrieved %s locations.",
498500
total_stops,
499501
stable_id,
500502
len(location_groups),
501503
)
502504
return (
503-
f"Processed {total_stops} stops for stable ID {stable_id}. Retrieved {len(location_groups)} locations.",
505+
f"Processed {total_stops} stops for stable ID {stable_id}. "
506+
f"Retrieved {len(location_groups)} locations.",
504507
200,
505508
)
506509

0 commit comments

Comments
 (0)