Merge pull request #837 from Gluejar/doab-exception-handling

try to fix missing scheme
pull/94/head
eshellman 2019-05-07 13:43:46 -04:00 committed by GitHub
commit eeb1551834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -42,7 +42,10 @@ def utf8_general_ci_norm(s):
return ''.join(c for c in s1 if not unicodedata.combining(c)).upper()
def get_soup(url, user_agent=settings.USER_AGENT):
response = requests.get(url, headers={"User-Agent": user_agent})
try:
response = requests.get(url, headers={"User-Agent": user_agent})
except requests.exceptions.MissingSchema:
response = requests.get('http://%s' % url, headers={"User-Agent": user_agent})
if response.status_code == 200:
soup = BeautifulSoup(response.content, 'lxml')