fix in case GSB value is missing

I noticed that GSB value is not retrieved in json causing "index out of range" error.
This fix checks if fields is available, otherwise go ahead.
If this field is not available anymore we can skip it and remove also from template long. I don't find documentation about this.
This commit is contained in:
garanews 2018-10-26 12:10:25 +02:00 committed by GitHub
parent c901627b8b
commit 09d3a35ed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ class URLhaus:
"link": cols[1].find("a").attrs.get("href"),
"status": cols[2].text,
"tags": cols[3].text.split(),
"gsb": cols[4].text,
"reporter": cols[5].text
"gsb": cols[4].text if len(cols) > 5 else None,
"reporter": cols[5].text if len(cols) > 5 else cols[4].text
})
return results