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