示例#1
0
def get(id):
    '''Retrieve the specified region

    Arguments:
        id:         the region ID

    Returns:
        a region object

    Example:
        print(wbgapi.region.get('NAC')['name'])
    '''

    return w.get('region/' + w.queryParam(id))
示例#2
0
def get(db=None):
    '''Retrieve the record for a single database

    Arguments:
        db:      the database ID (e.g., 2=WDI). Default to the global db

    Returns:
        a database object

    Example:
        print wbgapi.source.get(2)['name']
    '''

    return w.get(_sourceurl(db), {'databid': 'y'})
示例#3
0
def get(id):
    '''Retrieve the specified lending group

    Arguments:
        id:         the lending group ID

    Returns:
        a lending group object

    Example:
        print(wbgapi.lending.get('IBD')['value'])
    '''

    return w.get('lendingtype/' + w.queryParam(id))
示例#4
0
文件: topic.py 项目: tpike3/wbgapi
def get(id):
    '''Retrieve the specified topic

    Arguments:
        id:         the topic ID

    Returns:
        a topic object

    Example:
        print(wbgapi.topic.get(5)['value'])
    '''

    return w.get('topic/' + w.queryParam(id))
示例#5
0
def get(id):
    '''Retrieve the specified income group

    Arguments:
        id:         the income group ID

    Returns:
        an income group object

    Example:
        print(wbgapi.income.get('LIC')['name'])
    '''

    return w.get('incomelevel/' + w.queryParam(id))
示例#6
0
def feature(concept, id, db=None):
    '''Retrieve a single feature for the specified database. This is an internal function
    called by get() in other modules.

    Arguments:
        concept:    the concept to retrieve (e.g., 'series')

        id:         the object ID

        db:         the database to access (e.g., 2=WDI). Default uses the global database

    Returns:
        a database object

    Example:
        print(wbgapi.source.feature('series', 'SP.POP.TOTL')['value'])
    '''

    if db is None:
        db = w.db

    return w.get('sources/{}/{}/{}'.format(db, concepts(db)[concept]['key'], id))