diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-08-27 13:03:25 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-08-27 13:03:25 -0700 |
commit | 2e8e22b798c190a84e6cdcd6b66fd64f43f2631b (patch) | |
tree | 20861dfd2e507ffc60bf1b4122a58bfdf7f2c235 /python/fatcat_import.py | |
parent | 370afe1062807451f564f11c62b0a34b5017a42b (diff) | |
parent | 6eda9ff1a14f12531d99023fbcd7ff5a43b0c9aa (diff) | |
download | fatcat-2e8e22b798c190a84e6cdcd6b66fd64f43f2631b.tar.gz fatcat-2e8e22b798c190a84e6cdcd6b66fd64f43f2631b.zip |
Merge branch 'bnewbold-filemeta'
Diffstat (limited to 'python/fatcat_import.py')
-rwxr-xr-x | python/fatcat_import.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/python/fatcat_import.py b/python/fatcat_import.py index 252ab3a5..e92b3106 100755 --- a/python/fatcat_import.py +++ b/python/fatcat_import.py @@ -236,6 +236,14 @@ def run_datacite(args): else: JsonLinePusher(dci, args.json_file).run() +def run_file_meta(args): + # do_updates defaults to true for this importer + fmi = FileMetaImporter(args.api, + edit_batch_size=100, + editgroup_description=args.editgroup_description_override, + ) + JsonLinePusher(fmi, args.json_file).run() + def main(): parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter) @@ -556,6 +564,16 @@ def main(): auth_var="FATCAT_AUTH_WORKER_DATACITE", ) + sub_file_meta = subparsers.add_parser('file-meta', + help="simple update-only importer for file metadata") + sub_file_meta.set_defaults( + func=run_file_meta, + auth_var="FATCAT_API_AUTH_TOKEN", + ) + sub_file_meta.add_argument('json_file', + help="File with jsonlines from file_meta schema to import from", + default=sys.stdin, type=argparse.FileType('r')) + args = parser.parse_args() if not args.__dict__.get("func"): print("tell me what to do!") |