|
7 | 7 |
|
8 | 8 | import flask |
9 | 9 | import pandas as pd |
10 | | -import requests |
| 10 | +import requests as http_requests |
11 | 11 | import shapely.geometry |
12 | 12 | from geoalchemy2 import WKTElement |
13 | 13 | from geoalchemy2.shape import to_shape |
|
39 | 39 | from shared.helpers.logger import get_logger |
40 | 40 |
|
41 | 41 | from google.auth.transport import requests |
42 | | -from google.auth import id_token |
| 42 | +from google.oauth2 import id_token |
43 | 43 |
|
44 | 44 |
|
45 | 45 | @with_db_session |
@@ -392,7 +392,8 @@ def extract_location_aggregates( |
392 | 392 | token = id_token.fetch_id_token(auth_req, refresh_url) |
393 | 393 |
|
394 | 394 | # 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) |
396 | 397 |
|
397 | 398 | response.raise_for_status() |
398 | 399 | logger.info("Materialized view refresh event triggered successfully.") |
@@ -494,13 +495,15 @@ def reverse_geolocation_process( |
494 | 495 | overall_duration = (datetime.now() - overall_start).total_seconds() |
495 | 496 | logger.info(f"Total time taken for the process: {overall_duration:.2f} seconds") |
496 | 497 | 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.", |
498 | 500 | total_stops, |
499 | 501 | stable_id, |
500 | 502 | len(location_groups), |
501 | 503 | ) |
502 | 504 | 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.", |
504 | 507 | 200, |
505 | 508 | ) |
506 | 509 |
|
|
0 commit comments