diff options
Diffstat (limited to 'cloudinit/url_helper.py')
-rw-r--r-- | cloudinit/url_helper.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py index 7cf76aae..c83061a9 100644 --- a/cloudinit/url_helper.py +++ b/cloudinit/url_helper.py @@ -17,7 +17,11 @@ import time from email.utils import parsedate from functools import partial -import oauthlib.oauth1 as oauth1 +try: + import oauthlib.oauth1 as oauth1 +except ImportError: + oauth1 = None + from requests import exceptions from six.moves.urllib.parse import ( @@ -488,6 +492,10 @@ class OauthUrlHelper(object): def oauth_headers(url, consumer_key, token_key, token_secret, consumer_secret, timestamp=None): + + if oauth1 is None: + raise NotImplementedError('oauth support is not available') + if timestamp: timestamp = str(timestamp) else: |