import requests


def goa_calmgr(user_request, verbose=False):
    """
    Query the GOA galmgr API

    Parameters
        user_request:   Search request URL string, it should not contain 'calmgr'
\
    Return
        request_xml:    Query result in XML format
    """

    response = requests.get(
        'https://archive.gemini.edu/calmgr/' + user_request,
    )
    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError as exc:
        print('goa_calmgr: request failed: {}'.format(response.text))
        raise exc
    else:
        request_xml = response.content

    if verbose:
        print(response.url)
    # print(response.text)

    return request_xml