import requests


def get_pypi_package_releases(package_name):
    """
    calls PYPI json api as described here
    https://wiki.python.org/moin/PyPIJSON
    https://warehouse.readthedocs.io/api-reference/json.html
    :param package_name: string, pypi project name
    :return: json with pypi project response
    """

    result = requests.get('https://pypi.org/pypi/{}/json'.format(package_name))
    if result.status_code != 200:
        print('error occurred fetching package {} from PYPI.\n'
              'response is: {}'.format(package_name, result.reason))
        raise requests.exceptions.RequestException
    return result.json()