From: Roland Häder Date: Wed, 24 May 2023 06:40:12 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c2f192d707b0f7cc106bad8ce4f9f3a02db49227;p=fba.git Continued: - no shortening of packages --- diff --git a/fba.py b/fba.py index 79adabf..a4d3b73 100644 --- a/fba.py +++ b/fba.py @@ -1,10 +1,9 @@ -from bs4 import BeautifulSoup -from hashlib import sha256 - -import reqto +import bs4 +import hashlib import re -import sqlite3 +import reqto import json +import sqlite3 import sys import time import validators @@ -73,7 +72,7 @@ def is_blacklisted(domain: str) -> bool: return blacklisted def get_hash(domain: str) -> str: - return sha256(domain.encode("utf-8")).hexdigest() + return hashlib.sha256(domain.encode("utf-8")).hexdigest() def update_last_blocked(domain: str): # NOISY-DEBUG: print("DEBUG: Updating last_blocked for domain", domain) @@ -576,7 +575,7 @@ def get_mastodon_blocks(domain: str) -> dict: } try: - doc = BeautifulSoup( + doc = bs4.BeautifulSoup( reqto.get(f"https://{domain}/about/more", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"])).text, "html.parser", ) @@ -614,7 +613,7 @@ def get_friendica_blocks(domain: str) -> dict: blocks = [] try: - doc = BeautifulSoup( + doc = bs4.BeautifulSoup( reqto.get(f"https://{domain}/friendica", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"])).text, "html.parser", )