Skip to content

Commit

Permalink
🐛 Fix ip_risk.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AirportR committed Feb 28, 2024
1 parent 8e887cb commit 6d18ae0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions addons/builtin/ip_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ async def fetch_ip_risk(Collector, session: aiohttp.ClientSession, proxy=None, r
"""
try:
ip = ""
async with session.get('http://ip-api.com/json/', proxy=proxy, timeout=5) as ipres:
async with session.get('http://ip.sb', proxy=proxy, timeout=5, headers={'user-agent': "curl"}) as ipres:
if ipres.status == 200:
ipdata = await ipres.json()
ip = ipdata.get('query', '')
ip = await ipres.text()
if not ip:
async with session.get('http://ip-api.com/json/', proxy=proxy, timeout=5) as ipres:
if ipres.status == 200:
ipdata = await ipres.json()
ip = ipdata.get('query', '')
if ip != '':
url = baseurl + ip
else:
Expand Down

0 comments on commit 6d18ae0

Please sign in to comment.