Example #1
0
    """
    :type istat_helper: IstatHelper
    :param istat_helper:
    :return:
    """
    json_data = istat_helper.area(show=False)
    for area in json_data:
        list_dataset_dim(istat_helper, area)


if __name__ == "__main__":
    # cache_dir where to store downloaded data file
    JSONSTAT_HOME = os.path.join(os.path.dirname(__file__), "..")
    cache_dir = os.path.normpath(os.path.join(JSONSTAT_HOME, "istat-tests", "fixtures", "istat_cached"))
    downloader = jsonstat.Downloader(cache_dir)
    istat = IstatHelper(downloader, lang=1)

    # list_area_dataset_dim(istat_helper)

    istat.help()

    print("*** all areas")
    istat.area()

    # ...
    # {
    #      "Cod": "LAB",
    #      "Desc": "Lavoro",
    #      "Id": 26
    #  }
    # ...
    ex di area: {'Desc': 'Censimento popolazione e abitazioni 2011', 'Id': '3', 'Cod': 'CEN'}
    :type istat_helper: IstatHelper
    :param area:
    :return:
    """
    json_data = istat_helper.dslist(area['Id'], show=False)
    if json_data is not None:
        print("-------------------------")
        msg = u"area: {} '{}' nr. dataset {}".format(area['Id'], area['Desc'],
                                                     len(json_data))
        print(msg)
        for dataset in json_data:
            list_dim(istat_helper, dataset)
    else:
        print("--------------")
        print("cannot retrieve info for area {}".format(area))


if __name__ == "__main__":
    # cache_dir where to store downloaded data file
    # cache_dir = os.path.normpath(os.path.join(JSONSTAT_HOME, "istat-tests", "fixtures", "istat_cached"))
    JSONSTAT_HOME = os.path.join(os.path.dirname(__file__), "..")
    cache_dir = os.path.normpath(
        os.path.join(JSONSTAT_HOME, "tmp", "istat_cached"))
    downloader = jsonstat.Downloader(cache_dir)
    istat_helper = IstatHelper(downloader, lang=1)

    json_data = istat_helper.area(show=False)
    for area in json_data:
        list_dataset_dim(istat_helper, area)
Example #3
0
    :type istat_helper: IstatHelper
    :param istat_helper:
    :return:
    """
    json_data = istat_helper.area(show=False)
    for area in json_data:
        list_dataset_dim(istat_helper, area)


if __name__ == "__main__":
    # cache_dir where to store downloaded data file
    JSONSTAT_HOME = os.path.join(os.path.dirname(__file__), "..")
    cache_dir = os.path.normpath(
        os.path.join(JSONSTAT_HOME, "istat-tests", "fixtures", "istat_cached"))
    downloader = jsonstat.Downloader(cache_dir)
    istat = IstatHelper(downloader, lang=1)

    # list_area_dataset_dim(istat_helper)

    istat.help()

    print("*** all areas")
    istat.area()

    # ...
    # {
    #      "Cod": "LAB",
    #      "Desc": "Lavoro",
    #      "Id": 26
    #  }
    # ...
    """
    retrieve some information about dataset
    ex di area: {'Desc': 'Censimento popolazione e abitazioni 2011', 'Id': '3', 'Cod': 'CEN'}
    :type istat_helper: IstatHelper
    :param area:
    :return:
    """
    json_data = istat_helper.dslist(area['Id'], show=False)
    if json_data is not None:
        print("-------------------------")
        msg = u"area: {} '{}' nr. dataset {}".format(area['Id'], area['Desc'], len(json_data))
        print(msg)
        for dataset in json_data:
            list_dim(istat_helper, dataset)
    else:
        print("--------------")
        print("cannot retrieve info for area {}".format(area))


if __name__ == "__main__":
    # cache_dir where to store downloaded data file
    # cache_dir = os.path.normpath(os.path.join(JSONSTAT_HOME, "istat-tests", "fixtures", "istat_cached"))
    JSONSTAT_HOME = os.path.join(os.path.dirname(__file__), "..")
    cache_dir = os.path.normpath(os.path.join(JSONSTAT_HOME, "tmp", "istat_cached"))
    downloader = jsonstat.Downloader(cache_dir)
    istat_helper = IstatHelper(downloader, lang=1)

    json_data = istat_helper.area(show=False)
    for area in json_data:
        list_dataset_dim(istat_helper, area)