1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 13:02:38 +00:00

Caught argument errors and rxed the exception for output

This commit is contained in:
Myned 2017-10-15 15:32:35 -04:00
parent 2cf9faf08f
commit 9ca2a745d9

View file

@ -1,3 +1,5 @@
import re
from bs4 import BeautifulSoup
from lxml import html
@ -10,10 +12,13 @@ async def check_match(url):
try:
value = BeautifulSoup(content, 'html.parser').find_all('a')[1].get('href')
if value != '#':
return value
else:
raise IndexError
except IndexError:
raise exc.MatchError(url)
try:
raise exc.MatchError(re.search('\/([^\/]+)$', url).group(1))
if value != '#':
return value
else:
raise exc.MatchError(url)
except AttributeError:
raise exc.MissingArgument