code cleanup and edit README.md

This commit is contained in:
Frank 2024-11-10 17:06:04 +01:00
parent 5f467c30f1
commit 41a2d02b32
2 changed files with 9 additions and 7 deletions

View file

@ -25,9 +25,10 @@
I needed the ability to post a new post to Mastodon in my NodeBB forum.
It is configurable in the configuration which user of the NodeBB can post (UID)
This python script will be started with crontab.
Crontab will start every minute the python script.
The python script will check for new post. When a new post was found it will be post to mastodon.
This Python script will be started by a crontab job.
Crontab will execute the shell script nodebb_post_to_mastodon.sh every minute.
When the shell script starts the Python file main.py, it will check for a new post.
If a new post is found, it will send the post to Mastodon.
This project is quite far from perfect, but it helped me a lot to understand the world of Python, PyCharm and git a little.
@ -62,7 +63,8 @@ If it helps someone along the way as well, I'm glad. For questions and suggestio
crontab -u <USER> -e
This script is triggered by a crontab (every minute)
This script is triggered by a crontab job, which runs every minute.
Line 2 is for debugging purposes by logging the output.
# m h dom mon dow command
#* * * * * /home/<USER>/nodebb_post_to_mastodon/./nodebb_post_to_mastodon.sh >> /home/user_nodebb/nodebb_post_to_mastodon/cron_log.log 2>&1

View file

@ -34,9 +34,9 @@ URL = os.getenv("URL")
# Redis connection
###############################################
def connect_redis():
# When i need another db as 0 the redis user must have permission SELECT in redis.
# My user don't have this permission, so i set db to 0
# When i use REDIS_DB i got an error for missing SELCT permission!
# When I need another db as 0 the redis user must have permission SELECT in redis.
# My user don't have this permission, so I set db to 0
# When I use REDIS_DB I got an error for missing SELECT permission!
try:
# Connect to the Redis database with authentication
redis_connection = redis.Redis(host=REDIS_HOST,