From 5dc3308624502ecfad218e1562294375c9512e5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 11 Jul 2023 01:04:13 +0200 Subject: [PATCH] Fixed: - "TypeError: 'sqlite3.Row' object does not support item assignment" --- fba/commands.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index 6c06579..106964d 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -148,21 +148,21 @@ def fetch_pixelfed_api(args: argparse.Namespace) -> int: continue logger.debug("row[domain]='%s' - BEFORE!", row["domain"]) - row["domain"] = row["domain"].encode("idna").decode("utf-8") - logger.debug("row[domain]='%s' - AFTER!", row["domain"]) + domain = row["domain"].encode("idna").decode("utf-8") + logger.debug("domain='%s' - AFTER!", domain) - if not utils.is_domain_wanted(row["domain"]): - logger.warning("row[domain]='%s' is not wanted - SKIPPED!", row["domain"]) + if not utils.is_domain_wanted(domain): + logger.warning("domain='%s' is not wanted - SKIPPED!", domain) continue - elif instances.is_registered(row["domain"]): - logger.debug("row[domain]='%s' is already registered - SKIPPED!", row["domain"]) + elif instances.is_registered(domain): + logger.debug("domain='%s' is already registered - SKIPPED!", domain) continue - elif instances.is_recent(row["domain"]): - logger.debug("row[domain]='%s' has been recently crawled - SKIPPED!", row["domain"]) + elif instances.is_recent(domain): + logger.debug("domain='%s' has been recently crawled - SKIPPED!", domain) continue - logger.debug("Fetching instances from row[domain]='%s' ...", row["domain"]) - federation.fetch_instances(row["domain"], None, None, inspect.currentframe().f_code.co_name) + logger.debug("Fetching instances from domain='%s' ...", domain) + federation.fetch_instances(domain, None, None, inspect.currentframe().f_code.co_name) except network.exceptions as exception: logger.warning("Cannot fetch graphql,exception[%s]:'%s' - EXIT!", type(exception), str(exception)) @@ -920,19 +920,19 @@ def fetch_instances(args: argparse.Namespace) -> int: continue logger.debug("row[domain]='%s' - BEFORE!", row["domain"]) - row["domain"] = row["domain"].encode("idna").decode("utf-8") - logger.debug("row[domain]='%s' - AFTER!", row["domain"]) + domain = row["domain"].encode("idna").decode("utf-8") + logger.debug("domain='%s' - AFTER!", domain) - if not utils.is_domain_wanted(row["domain"]): - logger.warning("Domain row[domain]='%s' is not wanted - SKIPPED!", row["domain"]) + if not utils.is_domain_wanted(domain): + logger.warning("Domain domain='%s' is not wanted - SKIPPED!", domain) continue try: - logger.info("Fetching instances for domain='%s',origin='%s',software='%s',nodeinfo_url='%s'", row["domain"], row["origin"], row["software"], row["nodeinfo_url"]) - federation.fetch_instances(row["domain"], row["origin"], row["software"], inspect.currentframe().f_code.co_name, row["nodeinfo_url"]) + logger.info("Fetching instances for domain='%s',origin='%s',software='%s',nodeinfo_url='%s'", domain, row["origin"], row["software"], row["nodeinfo_url"]) + federation.fetch_instances(domain, row["origin"], row["software"], inspect.currentframe().f_code.co_name, row["nodeinfo_url"]) except network.exceptions as exception: - logger.warning("Exception '%s' during fetching instances (fetch_instances) from row[domain]='%s'", type(exception), row["domain"]) - instances.set_last_error(row["domain"], exception) + logger.warning("Exception '%s' during fetching instances (fetch_instances) from domain='%s'", type(exception), domain) + instances.set_last_error(domain, exception) logger.debug("Success - EXIT!") return 0 -- 2.39.5