def _master_api_request(master, endpoint, post_data=None):
    ip, port = master
    try:
        url = 'http://%s:%s/%s' % (ip, port, endpoint)
        if post_data:
            return requests.post(url, data=post_data, timeout=MESOS_REQUEST_TIMEOUT_SECS)
        return requests.get(url, timeout=MESOS_REQUEST_TIMEOUT_SECS)
    except (ConnectionError, __HOLE__, Timeout) as err:
        # Potentially transient network errors - don't crash Changes
        current_app.logger.warning('Network error during mesos master request (%s): %s', url, err, exc_info=True)
        return []
dataset/ETHPy150Open dropbox/changes/changes/lib/mesos_lib.py/_master_api_request