Digant Shetkar
Digant Shetkar

Reputation: 1

Used a random user_agent when using Geopy. What could be the consequences?

So, I realise this is a stupid question but hear me out. I wanted to find out the latitudes and longitudes from addresses in a dataframe.But when I ran the following cell, I got an error that asked me to specify 'user_agent'.

from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="specify_your_app_name_here")

As a joke, I ran the code with my nickname as the user_agent, and well, the code worked. What do you think happened? Also, what could be the consequences?

Upvotes: 0

Views: 349

Answers (2)

user2333250
user2333250

Reputation: 21

It seem to be logged for the incoming requests, most likely to later identify and fix the issues with the service. So, by sending random-random user agents you would make their work a little harder. You might also get banned for not complying with the service requirements. I suppose a random string is ok for one off testing, but for a regularly used script or a tool you better construct an actual user-agent string that identifies it.

Upvotes: 0

Boris Senkovskiy
Boris Senkovskiy

Reputation: 1

You can try openstreetmap.org

geolocator = Nominatim(user_agent="openstreetmap.org")

Upvotes: 0

Related Questions