Skip to content

Commit

Permalink
Implement danielwelch#52
Browse files Browse the repository at this point in the history
  • Loading branch information
mwitas-fp committed Feb 1, 2023
1 parent c73637d commit 064c1a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dropbox-sync/keep_last.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

def main(number_to_keep):

snapshot_info = requests.get(BASE_URL + "snapshots", headers=HEADERS)
snapshot_info = requests.get(BASE_URL + "backups", headers=HEADERS)
snapshot_info.raise_for_status()

snapshots = snapshot_info.json()["data"]["snapshots"]
snapshots = snapshot_info.json()["data"]["backups"]
for snapshot in snapshots:
d = parse(snapshot["date"])
if d.tzinfo is None or d.tzinfo.utcoffset(d) is None:
Expand All @@ -27,8 +27,8 @@ def main(number_to_keep):

for snapshot in stale_snapshots:
# call hassio API deletion
res = requests.post(
BASE_URL + "snapshots/" + snapshot["slug"] + "/remove",
res = requests.delete(
BASE_URL + "backups/" + snapshot["slug"] + "/remove",
headers=HEADERS)
if res.ok:
print("[Info] Deleted snapshot {}".format(snapshot["slug"]))
Expand Down

0 comments on commit 064c1a2

Please sign in to comment.