Browse Source

Merge "Lazy load oauthlib for plugin loading"

Jenkins 2 years ago
parent
commit
86e010cc83
2 changed files with 8 additions and 1 deletions
  1. 4
    0
      keystoneauth1/extras/oauth1/_loading.py
  2. 4
    1
      keystoneauth1/extras/oauth1/v3.py

+ 4
- 0
keystoneauth1/extras/oauth1/_loading.py View File

@@ -22,6 +22,10 @@ class V3OAuth1(loading.BaseIdentityLoader):
22 22
     def plugin_class(self):
23 23
         return v3.OAuth1
24 24
 
25
+    @property
26
+    def available(self):
27
+        return v3.oauth1 is not None
28
+
25 29
     def get_options(self):
26 30
         options = super(V3OAuth1, self).get_options()
27 31
 

+ 4
- 1
keystoneauth1/extras/oauth1/v3.py View File

@@ -23,7 +23,10 @@
23 23
 
24 24
 import logging
25 25
 
26
-from oauthlib import oauth1
26
+try:
27
+    from oauthlib import oauth1
28
+except ImportError:
29
+    oauth1 = None
27 30
 
28 31
 from keystoneauth1.identity import v3
29 32
 

Loading…
Cancel
Save