Skip to content

Commit

Permalink
Removed noisy debug and a fix for smicallef#1009.
Browse files Browse the repository at this point in the history
  • Loading branch information
smicallef committed Oct 15, 2020
1 parent 682793a commit cbe3b34
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions sflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,6 @@ def parseCreditCards(self, data):
for match in matches:

if int(match) == 0:
self.debug("Skipped invalid credit card number: " + match)
continue

ccNumber = match
Expand All @@ -1772,8 +1771,6 @@ def parseCreditCards(self, data):
if ccNumberTotal % 10 == 0:
self.debug("Found credit card number: " + match)
creditCards.add(match)
else:
self.debug("Skipped invalid credit card number: " + match)
return list(creditCards)

def getCountryCodeDict(self):
Expand Down Expand Up @@ -2151,11 +2148,9 @@ def parseIBANNumbers(self, data):
countryCode = iban[0:2]

if countryCode not in ibanCountryLengths.keys():
self.debug("Skipped invalid IBAN (invalid country code): %s" % iban)
continue

if len(iban) != ibanCountryLengths[countryCode]:
self.debug("Skipped invalid IBAN (invalid length): %s" % iban)
continue

# Convert IBAN to integer format.
Expand All @@ -2168,7 +2163,6 @@ def parseIBANNumbers(self, data):

# Check IBAN integer mod 97 for remainder
if int(iban_int) % 97 != 1:
self.debug("Skipped invalid IBAN: %s" % iban)
continue

self.debug("Found IBAN: %s" % iban)
Expand Down Expand Up @@ -2749,10 +2743,15 @@ def fetchUrl(
if dontMangle:
result['content'] = res.content
else:
try:
result['content'] = res.content.decode("utf-8")
except UnicodeDecodeError:
result['content'] = res.content.decode("ascii")
for encoding in ("utf-8", "ascii"):
try:
result["content"] = res.content.decode(encoding)
except UnicodeDecodeError:
pass
else:
break
else:
result["content"] = res.content

if fatal:
try:
Expand Down

0 comments on commit cbe3b34

Please sign in to comment.