diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-06-19 09:07:04 -0700 |
---|---|---|
committer | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-06-19 09:07:04 -0700 |
commit | dd6e8f354aaeeeaccc1566ab14cfd368d6ec1f72 (patch) | |
tree | 8ac2654fc1c0ef4d507f92ab4028668999afb73e /notification | |
parent | 4b29146c4d84a94c35e9f1bd763fcb85820e801c (diff) | |
download | ansible-modules-extras-dd6e8f354aaeeeaccc1566ab14cfd368d6ec1f72.tar.gz |
Modify a few more modules to not conditionalize urllib(2) import.
Diffstat (limited to 'notification')
-rw-r--r-- | notification/sendgrid.py | 3 | ||||
-rw-r--r-- | notification/twilio.py | 3 | ||||
-rw-r--r-- | notification/typetalk.py | 16 |
3 files changed, 9 insertions, 13 deletions
diff --git a/notification/sendgrid.py b/notification/sendgrid.py index 7a2ee3ad..e1ae7b77 100644 --- a/notification/sendgrid.py +++ b/notification/sendgrid.py @@ -84,7 +84,8 @@ EXAMPLES = ''' # ======================================= # sendgrid module support methods # -import urllib, urllib2 +import urllib +import urllib2 import base64 diff --git a/notification/twilio.py b/notification/twilio.py index a2dd77fb..ee12d987 100644 --- a/notification/twilio.py +++ b/notification/twilio.py @@ -104,7 +104,8 @@ EXAMPLES = ''' # ======================================= # twilio module support methods # -import urllib, urllib2 +import urllib +import urllib2 import base64 diff --git a/notification/typetalk.py b/notification/typetalk.py index 638f97ae..002c8b5c 100644 --- a/notification/typetalk.py +++ b/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"] |