fix: ip issue
This commit is contained in:
@@ -231,7 +231,8 @@ def set_country_from_ip(login_manager=None, user=None):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def get_country_code():
|
def get_country_code():
|
||||||
res = requests.get("http://ip-api.com/json/?fields=61439")
|
ip = frappe.local.request_ip
|
||||||
|
res = requests.get("http://ip-api.com/json/{ip}".format(ip=ip))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = res.json()
|
data = res.json()
|
||||||
@@ -239,8 +240,7 @@ def get_country_code():
|
|||||||
return data.get("country")
|
return data.get("country")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
return
|
||||||
return {}
|
|
||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def search_users(start=0, text=""):
|
def search_users(start=0, text=""):
|
||||||
|
|||||||
Reference in New Issue
Block a user