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:
parent
16bd2c7357
commit
5afc244147
4 changed files with 10 additions and 19 deletions
|
@ -31,7 +31,6 @@ description:
|
||||||
version_added: "1.6"
|
version_added: "1.6"
|
||||||
author: Seth Edwards
|
author: Seth Edwards
|
||||||
requirements:
|
requirements:
|
||||||
- urllib2
|
|
||||||
- base64
|
- base64
|
||||||
options:
|
options:
|
||||||
user:
|
user:
|
||||||
|
@ -107,11 +106,7 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
try:
|
import urllib2
|
||||||
import urllib2
|
|
||||||
HAS_URLLIB2 = True
|
|
||||||
except ImportError:
|
|
||||||
HAS_URLLIB2 = False
|
|
||||||
|
|
||||||
def post_annotation(module):
|
def post_annotation(module):
|
||||||
user = module.params['user']
|
user = module.params['user']
|
||||||
|
|
|
@ -84,7 +84,8 @@ EXAMPLES = '''
|
||||||
# =======================================
|
# =======================================
|
||||||
# sendgrid module support methods
|
# sendgrid module support methods
|
||||||
#
|
#
|
||||||
import urllib, urllib2
|
import urllib
|
||||||
|
import urllib2
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,8 @@ EXAMPLES = '''
|
||||||
# =======================================
|
# =======================================
|
||||||
# twilio module support methods
|
# twilio module support methods
|
||||||
#
|
#
|
||||||
import urllib, urllib2
|
import urllib
|
||||||
|
import urllib2
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ options:
|
||||||
description:
|
description:
|
||||||
- message body
|
- message body
|
||||||
required: true
|
required: true
|
||||||
requirements: [ urllib, urllib2, json ]
|
requirements: [ json ]
|
||||||
author: "Takashi Someda (@tksmd)"
|
author: "Takashi Someda (@tksmd)"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -33,15 +33,9 @@ EXAMPLES = '''
|
||||||
- typetalk: client_id=12345 client_secret=12345 topic=1 msg="install completed"
|
- typetalk: client_id=12345 client_secret=12345 topic=1 msg="install completed"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
import urllib
|
||||||
import urllib
|
|
||||||
except ImportError:
|
|
||||||
urllib = None
|
|
||||||
|
|
||||||
try:
|
import urllib2
|
||||||
import urllib2
|
|
||||||
except ImportError:
|
|
||||||
urllib2 = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
|
@ -96,8 +90,8 @@ def main():
|
||||||
supports_check_mode=False
|
supports_check_mode=False
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (urllib and urllib2 and json):
|
if not json:
|
||||||
module.fail_json(msg="urllib, urllib2 and json modules are required")
|
module.fail_json(msg="json module is required")
|
||||||
|
|
||||||
client_id = module.params["client_id"]
|
client_id = module.params["client_id"]
|
||||||
client_secret = module.params["client_secret"]
|
client_secret = module.params["client_secret"]
|
||||||
|
|
Loading…
Reference in a new issue