Summary
Geopy not Working on Streamlit Cloud , but working on Local system
Steps to reproduce
Code snippet:
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent = "geoapiExercises")
def countries(x):
#This function will use the Geolocator API and find the Country of the user.
# We split the result and provided the last part which contains the country name.
try:
location = geolocator.geocode(x,language='en',timeout=None)
return str(location.raw['display_name'].split(',')[-1]).strip()
except :
return None
st.header(countries('Delhi'))
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
the function works for this input in local env , but does not work for any input in Streamlit Cloud env
Actual behavior:
This Should return ‘India’ but gives error
**geopy.exc.GeocoderInsufficientPrivileges: Non-successful status code 403**
Debug info
- Streamlit version: streamlit-1.22.0
- Python version: 3.9
- Using streamlit Cloud
- OS version: NA
- Browser version: Latest
Requirements file
scikit-learn
nltk
emoji==2.2.0
wordcloud==1.8.2.2
tweepy
seaborn==0.12.2
geopy==2.3.0
Links
- Link to your GitHub repo:
- Link to your deployed app:
Additional information
If needed, add any other context about the problem here.