Fix break lat and long into seperate vars
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 6s
Build image - Testing / build-api-testing (push) Successful in 18s

This commit is contained in:
Evan 2025-01-22 19:42:00 -05:00
parent b9345096a1
commit c43acf2d1c
2 changed files with 5 additions and 4 deletions

View file

@ -1,7 +1,7 @@
from flask import jsonify, request
from twilio.twiml.voice_response import VoiceResponse, Gather
from utils import logger, validate_data_presence, _get_weather, _get_cords
from utils import logger, validate_data_presence, _get_weather, _get_cords, strq
# from config import
from . import routes as app
@ -106,7 +106,8 @@ def zipcode():
zipcode = request.values["zipcode"]
if len(zipcode) == 5:
weather = _get_weather(_get_cords(zipcode))
lat, long = _get_cords(zipcode)
weather = _get_weather(lat, long)
return strq(weather)
else:
return strq("Sorry, I don't understand that zipcode.")

View file

@ -106,8 +106,8 @@ def _get_cords(zipcode):
response = requests.get(url)
if response.status_code == 200:
zipcode = response.json()
return zipcode.lat, zipcode.long
locale = response.json()
return locale.lat, locale.long
else:
logger.error("Error in _get_cords: " + str(response.status_code))
return None, None