diff --git a/lib/ansible/modules/extras/monitoring/librato_annotation.py b/lib/ansible/modules/extras/monitoring/librato_annotation.py index 161caebb07..17b42284ba 100644 --- a/lib/ansible/modules/extras/monitoring/librato_annotation.py +++ b/lib/ansible/modules/extras/monitoring/librato_annotation.py @@ -31,7 +31,6 @@ description: version_added: "1.6" author: Seth Edwards requirements: - - urllib2 - base64 options: user: @@ -107,11 +106,7 @@ EXAMPLES = ''' ''' -try: - import urllib2 - HAS_URLLIB2 = True -except ImportError: - HAS_URLLIB2 = False +import urllib2 def post_annotation(module): user = module.params['user'] diff --git a/lib/ansible/modules/extras/notification/sendgrid.py b/lib/ansible/modules/extras/notification/sendgrid.py index 7a2ee3ad65..e1ae7b7749 100644 --- a/lib/ansible/modules/extras/notification/sendgrid.py +++ b/lib/ansible/modules/extras/notification/sendgrid.py @@ -84,7 +84,8 @@ EXAMPLES = ''' # ======================================= # sendgrid module support methods # -import urllib, urllib2 +import urllib +import urllib2 import base64 diff --git a/lib/ansible/modules/extras/notification/twilio.py b/lib/ansible/modules/extras/notification/twilio.py index a2dd77fb2c..ee12d987e9 100644 --- a/lib/ansible/modules/extras/notification/twilio.py +++ b/lib/ansible/modules/extras/notification/twilio.py @@ -104,7 +104,8 @@ EXAMPLES = ''' # ======================================= # twilio module support methods # -import urllib, urllib2 +import urllib +import urllib2 import base64 diff --git a/lib/ansible/modules/extras/notification/typetalk.py b/lib/ansible/modules/extras/notification/typetalk.py index 638f97ae53..002c8b5cc8 100644 --- a/lib/ansible/modules/extras/notification/typetalk.py +++ b/lib/ansible/modules/extras/notification/typetalk.py @@ -25,7 +25,7 @@ options: description: - message body required: true -requirements: [ urllib, urllib2, json ] +requirements: [ json ] author: "Takashi Someda (@tksmd)" ''' @@ -33,15 +33,9 @@ EXAMPLES = ''' - typetalk: client_id=12345 client_secret=12345 topic=1 msg="install completed" ''' -try: - import urllib -except ImportError: - urllib = None +import urllib -try: - import urllib2 -except ImportError: - urllib2 = None +import urllib2 try: import json @@ -96,8 +90,8 @@ def main(): supports_check_mode=False ) - if not (urllib and urllib2 and json): - module.fail_json(msg="urllib, urllib2 and json modules are required") + if not json: + module.fail_json(msg="json module is required") client_id = module.params["client_id"] client_secret = module.params["client_secret"]