Skip to content

Commit

Permalink
Add debug logs for openstreetmap.nominatim searches.
Browse files Browse the repository at this point in the history
  • Loading branch information
neprune committed Aug 20, 2024
1 parent 73d12a8 commit 99a9c04
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cobrand_hackney/api.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import json
import logging
import math
import sys

import requests
from django.conf import settings
from requests_cache import CachedSession


logger = logging.getLogger("noise")


api = settings.COBRAND_SETTINGS["address_api"]
if "pytest" in sys.modules:
session = requests.Session()
Expand Down Expand Up @@ -284,6 +289,9 @@ def geocode(q):
"format": "jsonv2",
},
)
logger.debug(
f"Attempted {url}\nSent: {'' if not hasattr(r.request, 'data') else r.request.data}\nGot: {r.text}\nStatus code: {r.status_code}."
)
r.raise_for_status()
data = r.json()
out = []
Expand Down

0 comments on commit 99a9c04

Please sign in to comment.