mirror of
https://github.com/evilhero/mylar
synced 2025-01-20 13:49:02 +00:00
log an error message when ComicVine has banned mylar's IP adddress for exceeding the rate limit.
This logs an error message when ComicVine returns HTML with the tag <title>Abnormal Traffic Detected.... The ban typically lasts a couple of days, and this may at least save the user some time in recognizing that a ban is the issue. This is only a suggestion. Feel free to close this if it's not a preferred solution!
This commit is contained in:
parent
a52fa27cb8
commit
dfc5c784e5
1 changed files with 12 additions and 2 deletions
14
mylar/mb.py
14
mylar/mb.py
|
@ -77,7 +77,10 @@ def pullsearch(comicapi, comicquery, offset, type):
|
|||
try:
|
||||
dom = parseString(r.content) #(data)
|
||||
except ExpatError:
|
||||
logger.warn('[WARNING] ComicVine is not responding correctly at the moment. This is usually due to some problems on their end. If you re-try things again in a few moments, it might work properly.')
|
||||
if u'<title>Abnormal Traffic Detected' in r.content:
|
||||
logger.error("ComicVine has banned this server's IP address because it exceeded the API rate limit.")
|
||||
else:
|
||||
logger.warn('[WARNING] ComicVine is not responding correctly at the moment. This is usually due to some problems on their end. If you re-try things again in a few moments, it might work properly.')
|
||||
return
|
||||
|
||||
return dom
|
||||
|
@ -444,7 +447,14 @@ def storyarcinfo(xmlid):
|
|||
# return
|
||||
# arcdata = file.read()
|
||||
# file.close()
|
||||
arcdom = parseString(r.content) #(arcdata)
|
||||
try:
|
||||
arcdom = parseString(r.content) #(arcdata)
|
||||
except ExpatError:
|
||||
if u'<title>Abnormal Traffic Detected' in r.content:
|
||||
logger.error("ComicVine has banned this server's IP address because it exceeded the API rate limit.")
|
||||
else:
|
||||
logger.warn('While parsing data from ComicVine, got exception: %s for data: %s' % (str(e), r.content))
|
||||
return
|
||||
|
||||
try:
|
||||
logger.fdebug('story_arc ascension')
|
||||
|
|
Loading…
Reference in a new issue