def get_huam(document_id, source):
    huam_url = HUAM_API_URL + "%s/%s?apikey=%s" % (source, document_id, HUAM_API_KEY)

    http = urllib3.PoolManager()
    response = http.request('GET', huam_url)
    huam = response.data

    if (huam.decode('utf8')==''):
        return (False, HttpResponse("The document ID %s does not exist" % document_id, status=404))

    return (True, huam.decode('utf8'))
def get_huam_gallery(document_id, source):
    huam_url = HUAM_API_URL + "%s/%s?apikey=%s" % (source, document_id, HUAM_API_KEY)

    http = urllib3.PoolManager()
    response = http.request('GET', huam_url)
    huam = response.data

    # Get the objects in the gallery
    huam_url = HUAM_API_URL + "object?apikey=%s&size=100&hasimage=1&fields=objectid,objectnumber,title,images&gallery=%s" % (HUAM_API_KEY, document_id)
    response = http.request('GET', huam_url)
    objects = response.data
    o = json.loads(objects.decode('utf8'))

    # Append the objects to the gallery
    j = json.loads(huam.decode('utf8'))
    j["objects"] = o["records"]

    if (huam.decode('utf8')==''):
        return (False, HttpResponse("The document ID %s does not exist" % document_id, status=404))

    return (True, json.dumps(j))