mirror of
https://github.com/Brandon-Rozek/website.git
synced 2024-11-25 01:26:30 -05:00
Updated toot grabber
This commit is contained in:
parent
18abecc776
commit
5f85a31a71
1 changed files with 2 additions and 3 deletions
|
@ -6,7 +6,6 @@ copy of Mastodon toots
|
||||||
|
|
||||||
from urllib import request
|
from urllib import request
|
||||||
from http.client import HTTPResponse
|
from http.client import HTTPResponse
|
||||||
from pathlib import Path
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
@ -25,7 +24,7 @@ toots_data = []
|
||||||
# Read in former toot data
|
# Read in former toot data
|
||||||
has_save = False
|
has_save = False
|
||||||
try:
|
try:
|
||||||
with open(TOOT_SAVE_FILE) as f:
|
with open(TOOT_SAVE_FILE, "r", encoding="UTF-8") as f:
|
||||||
toots_data = json.load(f)
|
toots_data = json.load(f)
|
||||||
has_save = True
|
has_save = True
|
||||||
print("Successfully read saved toot data")
|
print("Successfully read saved toot data")
|
||||||
|
@ -101,7 +100,7 @@ except:
|
||||||
|
|
||||||
# Write toots_data to the disk
|
# Write toots_data to the disk
|
||||||
try:
|
try:
|
||||||
with open(TOOT_SAVE_FILE, "w") as f:
|
with open(TOOT_SAVE_FILE, "w", encoding="UTF-8") as f:
|
||||||
json.dump(toots_data, f)
|
json.dump(toots_data, f)
|
||||||
except:
|
except:
|
||||||
print("Unable to write to save location.")
|
print("Unable to write to save location.")
|
||||||
|
|
Loading…
Reference in a new issue