Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 1

def get_location(+524481026428):

api_key = 'AIzaSyAJy4FoRda-sZQGX1WM_OrMzgxAReupj60'
url = f'https://www.googleapis.com/geolocation/v1/geolocate?key={api_key}'
headers = {'Content-Type': 'application/json'}
data = {
'considerIp': False,
'cellTowers': [
{
'cellId':+524481026428['cellId'],
'locationAreaCode': cell_data['lac'],
'mobileCountryCode': cell_data['mcc'],
'mobileNetworkCode': cell_data['mnc']
}
]
}

response = requests.post(url, headers=headers, json=data)


if response.status_code == 200:
result = response.json()
location = result.get('location')
return location
else:
return None

+524481026428 = {
'mcc': '334',
'mnc': '020',
'lac': '+52',
'cellId': '+524481026428'
}

location = get_location(+524481026428)

print(location)

You might also like