import googlemaps
import random

# Replace 'YOUR_API_KEY' with your actual API key
gmaps = googlemaps.Client(key='AIzaSyAtfIBXJoBhTDLqe59zWQ4qRQq7pIOkd58')

def find_random_restaurant(location, radius):
    places = gmaps.places_nearby(location=location, radius=radius, type='restaurant')
    if places['status'] == 'OK' and places['results']:
        random_place = random.choice(places['results'])
        return random_place['name']
    else:
        return 'No restaurants found nearby'

# Example usage
location = (40.7128, -74.0060)  # New York City coordinates
radius = 1000  # 1km radius
restaurant = find_random_restaurant(location, radius)
print(f'Random restaurant: {restaurant}')
