18574: Adds /arvados/v1/vocabulary to the discovery document.
[arvados.git] / sdk / python / arvados / util.py
index 2380e48b734005505f125a05f453e6b88c76265c..be8a03fc314d2cf599c16d5f44b1ab61cc9e885d 100644 (file)
@@ -491,3 +491,11 @@ def get_config_once(svc):
     if not hasattr(svc, '_cached_config'):
         svc._cached_config = svc.configs().get().execute()
     return svc._cached_config
+
+def get_vocabulary_once(svc):
+    if not svc._rootDesc.get('resources').get('vocabularies', False):
+        # Old API server version, no vocabulary export endpoint
+        return {}
+    if not hasattr(svc, '_cached_vocabulary'):
+        svc._cached_vocabulary = svc.vocabularies().get().execute()
+    return svc._cached_vocabulary