Formatting

This commit is contained in:
mrhanky 2017-08-22 14:57:14 +02:00
parent c5d08d2c35
commit 6acaccec7c
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -24,11 +24,12 @@ class Useless(DatabasePlugin):
address = args['<address>'] address = args['<address>']
if not address.startswith('http://'): if not address.startswith('http://'):
address = 'https://{}'.format(address) address = 'https://{}'.format(address)
parsed = urlparse(address)
try: try:
requests.head(address) requests.head(address)
state = 'up' state = 'up'
except requests.ConnectionError: except requests.ConnectionError:
state = 'down' state = 'down'
return '{}://{} seems to be {}'.format(parsed.scheme, parsed.netloc, state)
parsed = urlparse(address)
return '\x02{}://{}\x02 seems to be \x02{}\x02'.format(parsed.scheme, parsed.netloc, state)