diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-08 14:12:15 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-08 14:12:15 -0800 |
commit | a146ebbc3261f6cba6dc10e5a5524f6eca9ac98d (patch) | |
tree | 11a3dbdd4884c2c032144acafcaed003ac458ab6 /python/fatcat_export.py | |
parent | 0e344762101e9cb1f57a139c726fd50f2364ad51 (diff) | |
download | fatcat-a146ebbc3261f6cba6dc10e5a5524f6eca9ac98d.tar.gz fatcat-a146ebbc3261f6cba6dc10e5a5524f6eca9ac98d.zip |
start refactoring API object passing
Diffstat (limited to 'python/fatcat_export.py')
-rwxr-xr-x | python/fatcat_export.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/python/fatcat_export.py b/python/fatcat_export.py index 6a5395de..a59fcc0b 100755 --- a/python/fatcat_export.py +++ b/python/fatcat_export.py @@ -15,11 +15,9 @@ from fatcat_client.rest import ApiException from fatcat_client import ReleaseEntity from fatcat_tools import uuid2fcid, entity_from_json, release_to_elasticsearch -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(id=ident, expand="all") @@ -35,10 +33,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] @@ -92,6 +87,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__': |