How to use the akshare.wdbank.fetcher.fetch function in akshare

To help you get started, we’ve selected a few akshare examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jindaxiang / akshare / akshare / wdbank / api.py View on Github external
:incomelevel: desired incomelevel id or ids.
    :lendingtype: desired lendingtype id or ids.
    :cache: use the cache
    :returns: WBSearchResult containing dictionary objects representing each
        country
    """
    if country_id:
        if incomelevel or lendingtype:
            raise ValueError("Can't specify country_id and aggregates")
        return id_only_query(COUNTRIES_URL, country_id, cache=cache)
    args = {}
    if incomelevel:
        args["incomeLevel"] = parse_value_or_iterable(incomelevel)
    if lendingtype:
        args["lendingType"] = parse_value_or_iterable(lendingtype)
    return WBSearchResult(fetcher.fetch(COUNTRIES_URL, args, cache=cache))
github jindaxiang / akshare / akshare / wdbank / api.py View on Github external
query_url = COUNTRIES_URL
    try:
        c_part = parse_value_or_iterable(country)
    except TypeError:
        raise TypeError("'country' must be a string or iterable'")
    query_url = "/".join((query_url, c_part, "indicators", indicator))
    args = {}
    if data_date:
        if isinstance(data_date, collections.Sequence):
            data_date_str = ":".join((i.strftime("%Y") for i in data_date))
            args["date"] = data_date_str
        else:
            args["date"] = data_date.strftime("%Y")
    if source:
        args["source"] = source
    data = fetcher.fetch(query_url, args, cache=cache)
    if convert_date:
        data = convert_dates_to_datetime(data)
    return data