Addresses a couple of issues I found setting an API key:
r+ doesn't create the file if it's not found. Bug can be reproduced by deleting ~/.config/tumblr-backup
json.load(f) will fail raise an exception it reads an empty file, so we can give it a simple {} and then raise a more specific error if the user messes up their config
Truncates files before writing. Old contents of the file will remain if the new content is shorter. Idk if OAuth keys are of a fixed length, but doesn't hurt to keep around
Addresses a couple of issues I found setting an API key:
r+
doesn't create the file if it's not found. Bug can be reproduced by deleting~/.config/tumblr-backup
json.load(f)
will fail raise an exception it reads an empty file, so we can give it a simple{}
and then raise a more specific error if the user messes up their config