import requests


def getservice(node, service):
    """Query consul and return the HTTP URI of a given service"""
    query = "http://" + node + ":8500/v1/catalog/service/" + service
    output = requests.get(query).json()
    return "http://"+output[0]["Address"]+":"+str(output[0]["ServicePort"])