Boa, na verdade estou usando o próprio gmaps sem API, webscraping raiz mesmo kkk...
def get_address_info(origin, destination):
path_url = f"{url_base}/maps/dir/{origin}/{destination}".replace(" ", "+")
# print(path_url)
response = requests.get(path_url)
html = response.text
match = re.findall(r'window\.APP_INITIALIZATION_STATE=(.+?);', html)
if match:
data_str = match[0].strip().replace(")]}'", "")
data = json.loads(data_str)
other_data = json.loads(data[3][4])
distance_total = other_data[0][1][1][0][2][1]
time_total = other_data[0][1][1][0][3][1]
return distance_total, time_total
else:
return None, None