66import urllib .parse
77from time import sleep
88
9- import httpx
9+ import niquests
1010from langchain_core .tools import tool
1111from nc_py_api import Nextcloud
1212
@@ -22,7 +22,7 @@ def get_coordinates_for_address(address: str) -> (str, str):
2222 :param address: the address to calculate the coordinates for
2323 :return: a tuple of latitude and longitude
2424 """
25- res = httpx .get ('https://nominatim.openstreetmap.org/search' , params = {'q' : address , 'format' : 'json' , 'addressdetails' : '1' , 'extratags' : '1' , 'namedetails' : '1' , 'limit' : '1' })
25+ res = niquests .get ('https://nominatim.openstreetmap.org/search' , params = {'q' : address , 'format' : 'json' , 'addressdetails' : '1' , 'extratags' : '1' , 'namedetails' : '1' , 'limit' : '1' })
2626 json = res .json ()
2727 if 'error' in json :
2828 raise Exception (json ['error' ])
@@ -56,7 +56,7 @@ def get_osm_route(profile: str, origin_lat: str, origin_lon: str, destination_la
5656 profile_num = "2"
5757 url = f'https://routing.openstreetmap.de/{ profile } /route/v1/driving/{ origin_lon } ,{ origin_lat } ;{ destination_lon } ,{ destination_lat } ?overview=false&steps=true'
5858 map_url = f' https://routing.openstreetmap.de/?loc={ origin_lat } %2C{ origin_lon } &loc={ destination_lat } %2C{ destination_lon } &srv={ profile_num } '
59- res = httpx .get (url )
59+ res = niquests .get (url )
6060 json = res .json ()
6161 return {'route_json_description' : json , 'map_url' : map_url }
6262
@@ -70,7 +70,7 @@ def get_osm_link(location: str):
7070 :return: URL
7171 """
7272
73- res = httpx .get ('https://nominatim.openstreetmap.org/search' , params = {'q' : location , 'format' : 'json' ,'limit' : '1' })
73+ res = niquests .get ('https://nominatim.openstreetmap.org/search' , params = {'q' : location , 'format' : 'json' ,'limit' : '1' })
7474 json = res .json ()
7575 if 'error' in json :
7676 raise Exception (json ['error' ])
0 commit comments