Spaces:
Running
Running
File size: 384 Bytes
647d8a7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import requests
Regions = "IndiaPakistanBengal"
def check_region(ip):
session = requests.session()
ret = requests.get(f"https://api.ip2location.io/?ip={ip}")
nat = ret.json()['country_name'].lower()
if nat in Regions.lower():
print(nat, 'invalid')
return False
else:
print(nat, 'valid')
return True
check_region(ip='211.95.58.12')
|