Advanced-Try-On / tmp /tmp01.py
selfitcamera
init
647d8a7
raw
history blame
384 Bytes
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')