def request_overpass_elements(overpass_query):
    logger.debug("overpass_query:")
    logger.debug(overpass_query)

    # Kill any other query
    sync_utils.request(OVERPASS_API_BASE_URL + 'kill_my_queries')

    # Request data
    result = sync_utils.request(OVERPASS_API_BASE_URL + 'interpreter',
                                "post",
                                data=overpass_query)

    # Get elements from JSON
    return result.json()["elements"]
def request_wikipedia_api(wikipedia_query_params, language):
    result = sync_utils.request(
        WIKIPEDIA_API_BASE_URL.format(language=language),
        params=wikipedia_query_params)
    return result.json()
def request_commons_api(commons_query_params):
    result = sync_utils.request(COMMONS_API_BASE_URL,
                                params=commons_query_params)
    return result.json()
示例#4
0
def request_wikidata_api(wikidata_query_params):
    result = sync_utils.request(WIKIDATA_API_BASE_URL,
                                params=wikidata_query_params)
    return result.json()