Fix break lat and long into seperate vars
This commit is contained in:
parent
b9345096a1
commit
c43acf2d1c
2 changed files with 5 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
from flask import jsonify, request
|
from flask import jsonify, request
|
||||||
from twilio.twiml.voice_response import VoiceResponse, Gather
|
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 config import
|
||||||
from . import routes as app
|
from . import routes as app
|
||||||
|
@ -106,7 +106,8 @@ def zipcode():
|
||||||
zipcode = request.values["zipcode"]
|
zipcode = request.values["zipcode"]
|
||||||
|
|
||||||
if len(zipcode) == 5:
|
if len(zipcode) == 5:
|
||||||
weather = _get_weather(_get_cords(zipcode))
|
lat, long = _get_cords(zipcode)
|
||||||
|
weather = _get_weather(lat, long)
|
||||||
return strq(weather)
|
return strq(weather)
|
||||||
else:
|
else:
|
||||||
return strq("Sorry, I don't understand that zipcode.")
|
return strq("Sorry, I don't understand that zipcode.")
|
||||||
|
|
|
@ -106,8 +106,8 @@ def _get_cords(zipcode):
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
zipcode = response.json()
|
locale = response.json()
|
||||||
return zipcode.lat, zipcode.long
|
return locale.lat, locale.long
|
||||||
else:
|
else:
|
||||||
logger.error("Error in _get_cords: " + str(response.status_code))
|
logger.error("Error in _get_cords: " + str(response.status_code))
|
||||||
return None, None
|
return None, None
|
||||||
|
|
Loading…
Reference in a new issue