From c2f192d707b0f7cc106bad8ce4f9f3a02db49227 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 24 May 2023 08:40:12 +0200 Subject: [PATCH] Continued: - no shortening of packages --- fba.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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", ) -- 2.39.5