summaryrefslogtreecommitdiffstats
path: root/fatcat_client.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-04-23 17:36:22 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-04-23 17:36:22 -0700
commit5416a2570e7167ca2e62352dda10d2f371b994a7 (patch)
tree02439733d6b74dc6e83aaa49a314b49c5ece5a67 /fatcat_client.py
parent5bdd3f6e871599acb339aadc9b78cc12860f9759 (diff)
downloadfatcat-5416a2570e7167ca2e62352dda10d2f371b994a7.tar.gz
fatcat-5416a2570e7167ca2e62352dda10d2f371b994a7.zip
start work on api client
Diffstat (limited to 'fatcat_client.py')
-rwxr-xr-xfatcat_client.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/fatcat_client.py b/fatcat_client.py
new file mode 100755
index 00000000..4b3e1cc7
--- /dev/null
+++ b/fatcat_client.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+import argparse
+from fatcat.api_client import FatCatApiClient
+
+def import_crossref(args):
+ fcc = FatCatApiClient(args.host_url)
+ fcc.import_crossref_file(args.json_file)
+
+def health(args):
+ fcc = FatCatApiClient(args.host_url)
+ print(fcc.health())
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--debug',
+ action='store_true',
+ help="enable debugging interface")
+ parser.add_argument('--host-url',
+ default="http://localhost:8040",
+ help="connect to this host/port")
+ subparsers = parser.add_subparsers()
+
+ sub_import_crossref = subparsers.add_parser('import-crossref',
+ aliases=['lc'])
+ sub_import_crossref.set_defaults(func=import_crossref)
+ sub_import_crossref.add_argument('json_file',
+ help="")
+
+ sub_health = subparsers.add_parser('health')
+ sub_health.set_defaults(func=health)
+
+ args = parser.parse_args()
+ args.func(args)
+
+if __name__ == '__main__':
+ main()