Archived
1
0
Fork 0

experimental script for deleting all posts with one tag

This commit is contained in:
Lukas Winkler 2018-01-03 23:08:47 +01:00
parent 251d40acd8
commit 6604523359

32
delete.py Normal file
View file

@ -0,0 +1,32 @@
import requests
import yaml
from wallabag_api.wallabag import Wallabag
with open("config.yaml", 'r') as stream:
try:
config = yaml.load(stream)
except (yaml.YAMLError, FileNotFoundError) as exception:
print(exception)
config = None
exit(1)
token = Wallabag.get_token(**config["wallabag"])
wall = Wallabag(host=config["wallabag"]["host"], client_secret=config["wallabag"]["client_secret"],
client_id=config["wallabag"]["client_id"], token=token)
a=wall.get_entries(tags=["Golem"])
print(a)
b=a["_embedded"]
c=b["items"]
print(c)
exit()
try:
for i in c[1:]:
print(i["id"])
wall.delete_entries(i["id"])
print(i["id"])
except requests.exceptions.HTTPError as a:
print(a)
pass