import requests
import json


def post_request(url: str, headers: dict, path: str, data: dict)->dict:
    """
    Perform an HTTP POST request
    :param url: the url to POST to
    :param headers:a dict containing the ZT auth header
    :param path: the path to POST to
    :param data: a dict containing data to post
    :return: a dict converted from the returned JSON object

    raises a requests.exceptions.HTTPError when the response code is not 200

    """
    _url = url + path
    r = requests.post(_url, data=json.dumps(data), headers=headers)
    r.raise_for_status()
    return r.json()