GoogleMap API is not responding to Anvil Server

What I’ve tried and what’s not working:

I am using this google map API (https://maps.googleapis.com/maps/api/geocode/json?address=ADDRESS&key=YOUR_API_KEY) in the anvil server function and using that function to client code to get the latitude and longitude from the Address and I am facing the following Problem:

I am not getting the response form the GoogleMap API to Anvil server and in the result I am getting the Server Timeout error for the Client side, But the strange is that when I use the requestes module of Python then getting response from the GoogleMap Api and successfully get the latitude and longitude from the address.

So can you help me to tackle with this?
Also, I have attached the reference code which is working and which is not working respectively.

Code Sample:

# Working function
@anvil.server.callable
def geocode_address(address):
    """Geocode an address and return the latitude and longitude."""
    try:

        encoded_address = urllib.parse.quote(address)

        geocode_url = f"https://maps.googleapis.com/maps/api/geocode/json?address={encoded_address}&key={Globals_config.googleapi_API}"

        response = requests.get(geocode_url, timeout=30)

        response_data = response.json()

        if response_data['status'] == 'OK':
            location = response_data['results'][0]['geometry']['location']
            return location['lat'], location['lng']
        else:
            return None, None
    except requests.RequestException as e:
        return None, None
    except Exception as e:
        return None, None

#Not Working Function
@anvil.server.callable
def geocode_address(address):
    """Geocode an address and return the latitude and longitude."""
    try:
        encoded_address = urllib.parse.quote(address)
        
        geocode_url = f"https://maps.googleapis.com/maps/api/geocode/json?address={encoded_address}&key={Globals_config.googleapi_API}"
        
        response = anvil.http.request(url=geocode_url, method="GET", json=True, timeout=30)
        
        if response['status'] == 'OK':
            location = response['results'][0]['geometry']['location']
            return location['lat'], location['lng']
        else:
            return None, None
    except anvil.http.HttpError as e:
        return None, None
    except Exception as e:
        return None, None