First :D
This commit is contained in:
commit
37588421f3
100 changed files with 22673 additions and 0 deletions
20
plugins/down.py
Normal file
20
plugins/down.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import urlparse
|
||||
|
||||
from util import hook, http
|
||||
|
||||
|
||||
@hook.command
|
||||
def down(inp):
|
||||
'''.down <url> -- checks to see if the site is down'''
|
||||
|
||||
if 'http://' not in inp:
|
||||
inp = 'http://' + inp
|
||||
|
||||
inp = 'http://' + urlparse.urlparse(inp).netloc
|
||||
|
||||
# http://mail.python.org/pipermail/python-list/2006-December/589854.html
|
||||
try:
|
||||
http.get(inp, get_method='HEAD')
|
||||
return inp + ' seems to be up'
|
||||
except http.URLError:
|
||||
return inp + ' seems to be down'
|
Reference in a new issue