Merge pull request #649 from JakubOnderka/remove-deprecated

Resolve deprecation warnings
pull/650/head
Jakub Onderka 2024-01-08 21:46:07 +01:00 committed by GitHub
commit 4e91d3fb4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -27,7 +27,7 @@ def handler(q=False):
btc = request['btc']
query = f"{btc}.{url}"
try:
result = ' - '.join([str(r) for r in resolver.query(query, 'TXT')])[1:-1]
result = ' - '.join([str(r) for r in resolver.resolve(query, 'TXT')])[1:-1]
except NXDOMAIN:
result = f"{btc} is not known as a scam address."
except LabelTooLong:

View File

@ -50,7 +50,7 @@ def handler(q=False):
return misperrors
query = "{}.{}".format(requested_value, dbl)
try:
query_result = resolver.query(query, 'A')[0]
query_result = resolver.resolve(query, 'A')[0]
result = "{} - {}".format(requested_value, dbl_mapping[str(query_result)])
except dns.resolver.NXDOMAIN as e:
result = e.msg

View File

@ -36,7 +36,7 @@ def handler(q=False):
r.nameservers = ['8.8.8.8']
try:
answer = r.query(toquery, 'A')
answer = r.resolve(toquery, 'A')
except dns.resolver.NXDOMAIN:
misperrors['error'] = "NXDOMAIN"
return misperrors

View File

@ -27,7 +27,7 @@ def handler(q=False):
q = json.loads(q)
filename = q['attachment']
try:
img_array = np.fromstring(binascii.a2b_base64(q['data']), np.uint8)
img_array = np.frombuffer(binascii.a2b_base64(q['data']), np.uint8)
except Exception as e:
err = "Couldn't fetch attachment (JSON 'data' is empty). Are you using the 'Query enrichment' action?"
misperrors['error'] = err

View File

@ -42,7 +42,7 @@ def handler(q=False):
r.nameservers = ['8.8.8.8']
try:
answer = r.query(revname, 'PTR')
answer = r.resolve(revname, 'PTR')
except resolver.NXDOMAIN:
misperrors['error'] = "NXDOMAIN"
return misperrors

View File

@ -215,7 +215,7 @@ class TestExpansions(unittest.TestCase):
self.assertEqual(self.get_values(response), 'totalmateria.net - spam test domain')
except Exception:
try:
self.assertTrue(self.get_values(response).startswith('None of DNS query names exist:'))
self.assertTrue(self.get_values(response).startswith('The DNS query name does not exist:'))
except Exception:
self.assertEqual(self.get_errors(response), 'Not able to reach dbl.spamhaus.org or something went wrong')