somethingawful: use api_key hook instead of bot.config
This commit is contained in:
parent
0796167813
commit
248b220d9b
|
@ -19,13 +19,13 @@ def login(user, password):
|
||||||
post_data="action=login&username=%s&password=%s" % (user, password))
|
post_data="action=login&username=%s&password=%s" % (user, password))
|
||||||
|
|
||||||
|
|
||||||
|
@hook.api_key('somethingawful')
|
||||||
@hook.regex(thread_re)
|
@hook.regex(thread_re)
|
||||||
def forum_link(inp, bot=None):
|
def forum_link(inp, api_key=None):
|
||||||
if 'sa_user' not in bot.config or \
|
if api_key is None or 'user' not in api_key or 'password' not in api_key:
|
||||||
'sa_password' not in bot.config:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
login(bot.config['sa_user'], bot.config['sa_password'])
|
login(api_key['user'], api_key['password'])
|
||||||
|
|
||||||
thread = http.get_html(showthread, threadid=inp.group(1), perpage='1',
|
thread = http.get_html(showthread, threadid=inp.group(1), perpage='1',
|
||||||
cookies=True)
|
cookies=True)
|
||||||
|
|
Loading…
Reference in New Issue