from geopy.geocoders import Nominatim
from timezonefinder import TimezoneFinder
import pytz
from datetime import *
city_name = 'las vegas'
# it gives us geolocation of the city(then we can get longitude and latitude of the city)
geolocator = Nominatim(user_agent="geoapiExercises")
location = geolocator.geocode(city_name)
# by using this we find the time zone in searched city.
obj = TimezoneFinder()
result = obj.timezone_at(lng=location.longitude, lat=location.latitude)
home = pytz.timezone(result)
local_time = datetime.now(home)
print(local_time)