parent
daa2b825e1
commit
c1f5070de5
1 changed files with 3 additions and 3 deletions
|
@ -40,7 +40,7 @@ def root():
|
||||||
def redirectDomain(domain, action=None):
|
def redirectDomain(domain, action=None):
|
||||||
apiurl = f'https://unstoppabledomains.com/api/v1/{domain}'
|
apiurl = f'https://unstoppabledomains.com/api/v1/{domain}'
|
||||||
dnslookup = requests.get(apiurl)
|
dnslookup = requests.get(apiurl)
|
||||||
if action == None or action == 'redir':
|
if action == 'redir':
|
||||||
try:
|
try:
|
||||||
if dnslookup.status_code == 200:
|
if dnslookup.status_code == 200:
|
||||||
body = json.loads(dnslookup.content)
|
body = json.loads(dnslookup.content)
|
||||||
|
@ -54,7 +54,7 @@ def redirectDomain(domain, action=None):
|
||||||
return f'Error making call to {apiurl} for {domain}'
|
return f'Error making call to {apiurl} for {domain}'
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return f'Did not find a redirect for {domain}'
|
return f'Did not find a redirect for {domain}'
|
||||||
elif action == 'html':
|
elif action is None or action == 'html':
|
||||||
# TODO: clean this up by functionalizing this call. It's basically the same as above
|
# TODO: clean this up by functionalizing this call. It's basically the same as above
|
||||||
if dnslookup.status_code == 200:
|
if dnslookup.status_code == 200:
|
||||||
body = json.loads(dnslookup.content)
|
body = json.loads(dnslookup.content)
|
||||||
|
|
Loading…
Reference in a new issue