diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-08 16:28:27 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-08 16:28:27 -0800 |
commit | 16f2e78298dbd2231f5f337ea17c89a6a131a052 (patch) | |
tree | 6e72581e625e73c97cbab72d0f9c35665c99e5d7 /python/fatcat_export.py | |
parent | eb40a5f274f3608db34309cfd16739a7642ef5e7 (diff) | |
parent | ffb721f90c5d97ee80885209bf45feb85ca9625c (diff) | |
download | fatcat-16f2e78298dbd2231f5f337ea17c89a6a131a052.tar.gz fatcat-16f2e78298dbd2231f5f337ea17c89a6a131a052.zip |
Merge branch 'bnewbold-crude-auth'
Fixed a conflict in:
python/fatcat_export.py
Diffstat (limited to 'python/fatcat_export.py')
-rwxr-xr-x | python/fatcat_export.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/python/fatcat_export.py b/python/fatcat_export.py index 7d2a6508..cf8bf1c3 100755 --- a/python/fatcat_export.py +++ b/python/fatcat_export.py @@ -13,17 +13,17 @@ import argparse import fatcat_client from fatcat_client.rest import ApiException from fatcat_client import ReleaseEntity -from fatcat_tools import uuid2fcid, entity_from_json, release_to_elasticsearch +from fatcat_tools import uuid2fcid, entity_from_json, entity_to_dict, \ + release_to_elasticsearch, public_api -def run_export_releases(args): - conf = fatcat_client.Configuration() - conf.host = args.host_url - api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) +def run_export_releases(args): + api = args.api for line in args.ident_file: ident = uuid2fcid(line.split()[0]) release = api.get_release(ident=ident, expand="all") - args.json_output.write(json.dumps(release.to_dict()) + "\n") + args.json_output.write( + json.dumps(entity_to_dict(release)) + "\n") def run_transform_releases(args): for line in args.json_input: @@ -35,10 +35,7 @@ def run_transform_releases(args): json.dumps(release_to_elasticsearch(release)) + '\n') def run_export_changelog(args): - conf = fatcat_client.Configuration() - conf.host = args.host_url - api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) - + api = args.api end = args.end if end is None: latest = api.get_changelog(limit=1)[0] @@ -46,7 +43,8 @@ def run_export_changelog(args): for i in range(args.start, end): entry = api.get_changelog_entry(index=i) - args.json_output.write(json.dumps(entry.to_dict()) + "\n") + args.json_output.write( + json.dumps(entity_to_dict(entry)) + "\n") def main(): parser = argparse.ArgumentParser() @@ -92,6 +90,8 @@ def main(): if not args.__dict__.get("func"): print("tell me what to do!") sys.exit(-1) + + args.api = public_api(args.host_url) args.func(args) if __name__ == '__main__': |