import requests
import json


def vaultPutBulk(url, params, body, sessionId):
    """
    Make an HTTP PUT request to Vault.

    :param url: the URL to PUT
    :param params: query parameters
    :param body: update body
    :param sessionId: vault sessionId

    :return: responseStr: JSON response string from Vault API call
    """
    headers = {'Authorization': sessionId,'Content-Type': 'application/json','Accept': 'application/json'}
    responseStr = requests.put(url, params=params, json=body, headers=headers)
    response = json.loads(responseStr.content)
    if response['responseStatus'] != 'SUCCESS':
        print('Bulk update failed\nHTTP PUT request to Vault\n' +
                    'ERROR while putting to URL "' + url + '": ' +
                    response['errors'][0]['message'])
        
    return responseStr