Skip to content

Commit

Permalink
Merge pull request #1368 from yogeshojha/1364-bug-error-during-whois-…
Browse files Browse the repository at this point in the history
…lookup

#1364 FIx whois lookup and improve performance by executing various modules of whois lookup to run concurrently
  • Loading branch information
yogeshojha authored Aug 13, 2024
2 parents 702425a + bfe5a8a commit 7e617c1
Show file tree
Hide file tree
Showing 6 changed files with 640 additions and 494 deletions.
10 changes: 6 additions & 4 deletions web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,13 +1126,15 @@ def get(self, request):
class Whois(APIView):
def get(self, request):
req = self.request
ip_domain = req.query_params.get('ip_domain')
if not (validators.domain(ip_domain) or validators.ipv4(ip_domain) or validators.ipv6(ip_domain)):
print(f'Ip address or domain "{ip_domain}" did not pass validator.')
target = req.query_params.get('target')
if not target:
return Response({'status': False, 'message': 'Target IP/Domain required!'})
if not (validators.domain(target) or validators.ipv4(target) or validators.ipv6(target)):
print(f'Ip address or domain "{target}" did not pass validator.')
return Response({'status': False, 'message': 'Invalid domain or IP'})
is_force_update = req.query_params.get('is_reload')
is_force_update = True if is_force_update and 'true' == is_force_update.lower() else False
task = query_whois.apply_async(args=(ip_domain,is_force_update))
task = query_whois.apply_async(args=(target,is_force_update))
response = task.wait()
return Response(response)

Expand Down
Loading

0 comments on commit 7e617c1

Please sign in to comment.