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