1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Modify a few more modules to not conditionalize urllib(2) import.

This commit is contained in:
Toshio Kuratomi 2015-06-19 09:07:04 -07:00 committed by Matt Clay
parent 16bd2c7357
commit 5afc244147
4 changed files with 10 additions and 19 deletions

View file

@ -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']

View file

@ -84,7 +84,8 @@ EXAMPLES = '''
# =======================================
# sendgrid module support methods
#
import urllib, urllib2
import urllib
import urllib2
import base64

View file

@ -104,7 +104,8 @@ EXAMPLES = '''
# =======================================
# twilio module support methods
#
import urllib, urllib2
import urllib
import urllib2
import base64

View file

@ -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"]