Fix deprecated warnings

This commit is contained in:
Rémy Léone 2018-04-06 11:01:42 +02:00 committed by Toshio Kuratomi
parent 3664c74cb8
commit 98fb47b061
5 changed files with 20 additions and 16 deletions

View file

@ -80,15 +80,16 @@ EXAMPLES = '''
delegate_to: localhost
'''
import base64
import json
import base64
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
from ansible.module_utils._text import to_bytes
def request(module, url, user, oauthkey, data='', method='GET'):
auth = base64.encodestring('%s:%s' % (user, oauthkey)).replace('\n', '')
auth = base64.b64encode(to_bytes('%s:%s' % (user, oauthkey)).replace('\n', ''))
headers = {
'Authorization': 'Basic %s' % auth,
}