This commit is contained in:
gsinghpal
2026-04-24 21:04:38 -04:00
parent 0eab4b4efb
commit 41d0908ade
4083 changed files with 1230780 additions and 287 deletions

View File

@@ -32,12 +32,16 @@ class ResPartner(models.Model):
addr = address.strip()
nominatim_url = (ICP.get_param('fusion_tasks.nominatim_url', '') or '').strip()
if nominatim_url:
headers = {'User-Agent': 'fusion_tasks/1.0'}
maps_key = (ICP.get_param('fusion_tasks.maps_api_key', '') or '').strip()
if maps_key:
headers['X-API-Key'] = maps_key
try:
resp = requests.get(
f'{nominatim_url.rstrip("/")}/search',
params={'q': addr, 'format': 'json', 'limit': 1, 'countrycodes': 'ca'},
timeout=5,
headers={'User-Agent': 'fusion_tasks/1.0'},
headers=headers,
)
data = resp.json()
if isinstance(data, list) and data: