<commit_before>#!/usr/bin/env python
# Description: Script to get data using 2 extractor
# First extractor give urls as output, than are then
# used as input in the second extractor
__author__ = 'ignacioelola'

import importio_rsc


def get_data(guid_level_1, guid_level_2, start_url):

    query_level_1 = {"input": {"webpage/url": start_url}}

    response_level_1 = importio_rsc.query_api(query_level_1, guid_level_1)

    all_results = []
    for result in response_level_1["results"]:
        source_url_level_2 = result["url"]
        print source_url_level_2
        query_level_2 = {"input": {"webpage/url": source_url_level_2}}
        response_level_2 = importio_rsc.query_api(query_level_2, guid_level_2)

        results_level_2 = response_level_2.get("results")

        all_results.append({"url": source_url_level_2,
                            "url/_text": result["url/_text"],
                            "results": results_level_2})

    return all_results<commit_msg>Better messaging in console<commit_after>#!/usr/bin/env python
# Description: Script to get data using 2 extractor
# First extractor give urls as output, than are then
# used as input in the second extractor
__author__ = 'ignacioelola'

import importio_rsc


def get_data(guid_level_1, guid_level_2, start_url):

    query_level_1 = {"input": {"webpage/url": start_url}}

    response_level_1 = importio_rsc.query_api(query_level_1, guid_level_1)

    all_results = []
    for result in response_level_1["results"]:
        source_url_level_2 = result["url"]
        print "Querying %s" % source_url_level_2
        query_level_2 = {"input": {"webpage/url": source_url_level_2}}
        response_level_2 = importio_rsc.query_api(query_level_2, guid_level_2)

        results_level_2 = response_level_2.get("results")

        all_results.append({"url": source_url_level_2,
                            "url/_text": result["url/_text"],
                            "results": results_level_2})

    return all_results
{'fraction_non_alphanumeric': 0.098, 'fraction_numerical': 0.019, 'mean_word_length': 3.436807095343681, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4397098', 'n_tokens_mistral': 659, 'n_tokens_neox': 638, 'n_words': 138}