'Geopy Nominatim broke Heroku deploy
I deploy my telegram bot on Heroku and I use pyTelegramBotapi and geopy. The last time I deploy, it was 10 days ago, all was working fine but today when I starting command /geo I found that goopy Nominatim broken my function when it is on Heroku, but if bot is working on my computer everything is working great. What's the matter?
def geo_continue(message):
bot.send_message(message.chat.id,"We are here!")
if message.location!=None:
from geopy import Nominatim
global locator
locator = Nominatim(user_agent="myGeocoder")
global users_latitude,users_longitude
users_latitude = message.location.latitude
users_longitude = message.location.longitude
bot.send_message(message.chat.id,locator.reverse(f"{message.location.latitude}, {message.location.longitude}",language="ru"))#it is breaking here
bot.send_message(message.chat.id,f"{users_longitude}, {users_latitude}")
if locator.reverse(f"{message.location.latitude}, {message.location.longitude}",language="ru") is None:
if users_language == 0:
bot.send_message(message.chat.id, "Sorry, this function works only in Belarus, yet.")
else:
bot.send_message(message.chat.id, "Извините, эта функция работает пока только в Беларуси.")
non_keyboard = types.ReplyKeyboardRemove(selective=False)
bot.send_message(message.chat.id, "Ok.", reply_markup=non_keyboard)
else:
bot.send_message(message.chat.id, "Now we are here!")
users_geo_data = locator.reverse(f"{message.location.latitude}, {message.location.longitude}",
language="ru").raw
Solution 1:[1]
Check if you have included geopy in your requirements.txt file
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | chelovekskelet |