PEP8, lots of tweaks/fixes
This commit is contained in:
parent
641b770dc3
commit
508fec8ae8
29 changed files with 165 additions and 111 deletions
|
@ -1,7 +1,10 @@
|
|||
import re
|
||||
from util import hook, http, misc
|
||||
from util import hook
|
||||
from util import http
|
||||
from util import misc
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
|
||||
|
||||
@hook.command(autohelp=False)
|
||||
def fact(inp, say=False, nick=False):
|
||||
".fact -- Gets a random fact from OMGFACTS."
|
||||
|
@ -15,10 +18,11 @@ def fact(inp, say=False, nick=False):
|
|||
|
||||
return u"%s [ %s ]" % (fact, link)
|
||||
|
||||
|
||||
def get_fact():
|
||||
page = http.get('http://www.omg-facts.com/random')
|
||||
soup = BeautifulSoup(page)
|
||||
container = soup.find('a', {'class' : 'surprise'})
|
||||
container = soup.find('a', {'class': 'surprise'})
|
||||
link = container['href']
|
||||
|
||||
fact = misc.strip_html(container.renderContents())
|
||||
|
|
Reference in a new issue