Skip to content

Commit

Permalink
2.019 not treating BadStatusLine as proxy error
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Feb 25, 2018
1 parent 6d5bfd9 commit 3a78abe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xeHentai/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
import time
import random
from requests.exceptions import ConnectTimeout, ConnectionError, InvalidSchema
from requests.exceptions import ConnectTimeout, ConnectionError, ProxyError, InvalidSchema
from requests.packages.urllib3.exceptions import ProxySchemeUnknown
from . import util
from .const import *
Expand Down Expand Up @@ -59,8 +59,11 @@ def __(*args, **kwargs):
r = func(*args, **kwargs)
except Exception as _ex:
ex = _ex
for e in [ConnectTimeout, ConnectionError] + exceptions:
for e in [ConnectTimeout, ConnectionError, ProxyError] + exceptions:
if isinstance(ex, e):
# ignore BadStatusLine, this doesn't mean the proxy is bad
if e == ConnectionError and 'BadStatusLine' in str(e):
continue
self.proxies[addr][2] += weight
break
else:
Expand Down

0 comments on commit 3a78abe

Please sign in to comment.