import requests


def onefs_papi_version(host, port, auth):
    """Query cluster for latest PAPI version."""
    url = 'https://{0}:{1}/platform/latest'.format(host, port)
    try:
        return requests.get(url, auth=auth, verify=False).json()['latest']
    except KeyError:
        # latest handler did not exist before API version 3
        return '2'