Add better timeout to the blocklist script
parent
92b9ce3b8b
commit
aca3d807ba
|
@ -1,4 +1,4 @@
|
|||
requests
|
||||
pythorhead
|
||||
pythonseer>=0.1.3
|
||||
pythonseer>=0.16.0
|
||||
python-dotenv
|
|
@ -47,7 +47,7 @@ min_censures = 1
|
|||
changes_warning_threshold = 10
|
||||
|
||||
password = os.getenv("LEMMY_PASSWORD", PASSWORD)
|
||||
lemmy = Lemmy(f"https://{LEMMY_DOMAIN}")
|
||||
lemmy = Lemmy(f"https://{LEMMY_DOMAIN}", request_timeout=15)
|
||||
if lemmy.log_in(USERNAME, password) is False:
|
||||
raise Exception("Could not log in to lemmy")
|
||||
|
||||
|
@ -116,7 +116,10 @@ else:
|
|||
ret = lemmy.site.edit(
|
||||
blocked_instances=list(defed),
|
||||
)
|
||||
print("Edit Successful")
|
||||
with open("previous_defed.json", 'w') as file:
|
||||
file.write(json.dumps(list(defed),indent=4))
|
||||
print("Stored previous defed list to disk file 'previous_defed.json'")
|
||||
if ret is None:
|
||||
print("Edit Failed!")
|
||||
else:
|
||||
print("Edit Successful.")
|
||||
with open("previous_defed.json", 'w') as file:
|
||||
file.write(json.dumps(list(defed),indent=4))
|
||||
print("Stored previous defed list to disk file 'previous_defed.json'")
|
||||
|
|
Loading…
Reference in New Issue