Hey! It's me again...

I am fairly confident that this script should work, but can't be sure since I now know that all the Hive Python libraries are out of date.
This script should calculate a score for each commenter on a Hive blockchain post.
The code is meant to explain the comments (the lines that start with '#') to the computer. You can read the comments and see what the code is supposed to make the computer do.
# Import needed libraries
import datetime
import string
from lighthive.client import Client
from lighthive.helpers.event_listener import EventListener
# Establish connection to Hive using the 'Client' library.
client = Client()
account = client.account('gamer00') # Not sure whether this one is actually needed or not.)
# Ask the user for a post url or path (with or without the preceding http server address):
post_url = input("Enter a post url or path: ")
# Get the post data
post_data = client.get_content(post_url)
# Initialize author comment count dictionary:
author_comment_count = {}
# Create a list of excluded accounts, save it as a file called "exclusion.list":
#exclusionlist = ["account1", "account2", "account3"]
try:
with open("exclusion.list", "r") as f:
exclusionlist = f.read().splitlines()
except FileNotFoundError:
exclusionlist = []
# Ask the user for the excluded authors, and if they don't already exist,
# write them to the "exclusion.list" file.
excluded_authors = input("Enter the excluded authors (comma-separated): ")
if excluded_authors:
excluded_authors = excluded_authors.split(",")
for author in excluded_authors:
author = author.strip()
# Check for no doubles, and then append the name to the list:
if author not in exclusionlist:
exclusionlist.append(author)
with open("exclusion.list", "w") as f:
f.write("\n".join(exclusionlist))
# Loop through the comments of the post and calculate a score by 1 point per comment for each author:
for comment in post_data['comments']:
author = comment['author']
if author in exclusionlist:
continue
if author in author_comment_count:
author_comment_count[author] += 1
else:
author_comment_count[author] = 1
# Print the scores
print("Commenter scores:")
for author, score in author_comment_count.items():
print(f"{author}: {score}")
While I am confident this script is mostly correct, I would still like to ask @emrebeyler, the creator of the LightHive library, whether I've made any glaring mistakes. It's a bit difficult to know if it's the libraries, or my code that breaks and gives me these errors (oh, and the exact same thing happens with just the path, and with both full url):
➜ python Comment_scoring.py
Enter a post url or path: /quiz/@gamer00/which-u-s-president-quiz-a56a71e5e7dac
Traceback (most recent call last):
File "/home/ambience/Projects/Code/Python/Hive/Hive/comment-counter/Comment_scoring.py", line 15, in <module>
post_data = client.get_content(post_url)
File "/home/ambience/.local/lib/python3.10/site-packages/lighthive/client.py", line 61, in callable
return self.request(attr, *args, **kwargs)
File "/home/ambience/.local/lib/python3.10/site-packages/lighthive/client.py", line 178, in request
self.validate_response(response)
File "/home/ambience/.local/lib/python3.10/site-packages/lighthive/client.py", line 190, in validate_response
raise RPCNodeException(
lighthive.exceptions.RPCNodeException: Invalid parameters
Hive/Hive/comment-counter via �� v3.10.9 took 18s
❯
I'd be very appreciative for any advice and/or criticism. If you find a mistake, please mention about it.
Thank you for reading this!