diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-29 15:13:18 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-29 15:13:20 -0800 |
commit | af04083c4d97bb133ec5a7b40b98cbaf245584ec (patch) | |
tree | 99d7aa2a21d3f5917284759ff6722825ce4c86af /extra | |
parent | a849375e2c099336cc8df058624a1d393f61ec22 (diff) | |
download | fatcat-af04083c4d97bb133ec5a7b40b98cbaf245584ec.tar.gz fatcat-af04083c4d97bb133ec5a7b40b98cbaf245584ec.zip |
helper to delete 'builtin' example entities
Idea is to clear these before "real" metadata import.
Diffstat (limited to 'extra')
-rw-r--r-- | extra/demo_entities/delete_builtins.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/extra/demo_entities/delete_builtins.py b/extra/demo_entities/delete_builtins.py new file mode 100644 index 00000000..31af7a8f --- /dev/null +++ b/extra/demo_entities/delete_builtins.py @@ -0,0 +1,73 @@ + +# cp ../extra/demo_entities/delete_builtins.py . +# pipenv run python3 delete_builtins.py + +import fatcat_client +from fatcat_tools import * +import os + +token = os.environ['FATCAT_API_AUTH_TOKEN'] +assert token +api = authenticated_api('http://localhost:9411/v0', token) + +eg = api.create_editgroup(fatcat_client.Editgroup( + description="Clear out built-in database example entities")) + +container_ids = ( + "aaaaaaaaaaaaaeiraaaaaaaaae", + "aaaaaaaaaaaaaeiraaaaaaaaai", + "aaaaaaaaaaaaaeiraaaaaaaaam", +) +creator_ids = ( + "aaaaaaaaaaaaaircaaaaaaaaae", + "aaaaaaaaaaaaaircaaaaaaaaai", + "aaaaaaaaaaaaaircaaaaaaaaam", + #"aaaaaaaaaaaaaircaaaaaaaaaq", +) +file_ids = ( + "aaaaaaaaaaaaamztaaaaaaaaae", + "aaaaaaaaaaaaamztaaaaaaaaai", + "aaaaaaaaaaaaamztaaaaaaaaam", +) +fileset_ids = ( + "aaaaaaaaaaaaaztgaaaaaaaaam", + "aaaaaaaaaaaaaztgaaaaaaaaai", + #"aaaaaaaaaaaaaztgaaaaaaaaam", +) +webcapture_ids = ( + "aaaaaaaaaaaaa53xaaaaaaaaae", + "aaaaaaaaaaaaa53xaaaaaaaaai", + "aaaaaaaaaaaaa53xaaaaaaaaam", +) +release_ids = ( + "aaaaaaaaaaaaarceaaaaaaaaae", + "aaaaaaaaaaaaarceaaaaaaaaai", + "aaaaaaaaaaaaarceaaaaaaaaam", +) +work_ids = ( + "aaaaaaaaaaaaavkvaaaaaaaaae", + "aaaaaaaaaaaaavkvaaaaaaaaai", + "aaaaaaaaaaaaavkvaaaaaaaaam", +) + +for eid in container_ids: + api.delete_container(eid, editgroup_id=eg.editgroup_id) +for eid in creator_ids: + api.delete_creator(eid, editgroup_id=eg.editgroup_id) +for eid in file_ids: + api.delete_file(eid, editgroup_id=eg.editgroup_id) +for eid in fileset_ids: + api.delete_fileset(eid, editgroup_id=eg.editgroup_id) +for eid in webcapture_ids: + api.delete_webcapture(eid, editgroup_id=eg.editgroup_id) +for eid in release_ids: + api.delete_release(eid, editgroup_id=eg.editgroup_id) +for eid in work_ids: + api.delete_work(eid, editgroup_id=eg.editgroup_id) + +api.accept_editgroup(eg.editgroup_id) + +# editgroup aaaaaaaaaaaabo53aaaaaaaaa4 should be un-submitted +partial_eg = api.get_editgroup('aaaaaaaaaaaabo53aaaaaaaaa4') +api.update_editgroup('aaaaaaaaaaaabo53aaaaaaaaa4', partial_eg, submit=False) + |