예제 #1
0
파일: plus.py 프로젝트: buzzworkers/tl
def getplus(target):
    credentials = import_byfile("credentials", getdatadir() + os.sep + "config" + os.sep + "credentials.py")
    url = "https://www.googleapis.com/plus/v1/people/%s/activities/public?alt=json&pp=1&key=%s" % (target, credentials.googleclient_apikey)
    result = geturl2(url)
    data = json.loads(result)
    res = []
    for item in data['items']:
        i = LazyDict(item)
        res.append("%s - %s - %s" % (i.actor['displayName'], i['title'], item['url']))
    return res
예제 #2
0
파일: creds.py 프로젝트: buzzworkers/tl
def getcredsmod(datadir=None, doraise=False):
    """ returnd credendtials.py as a module. """
    if not datadir: datadir = getdatadir()
    try:
        mod = import_byfile("credentials", datadir + os.sep + "config" + os.sep + "credentials.py")
        global go
        go = True
    except (IOError, ImportError):
        if doraise: raise RequireError("credentials.py is needed in %s/config dir. see %s/examples" % (datadir, datadir))
        else: logging.warn("credentials.py is needed in %s/config dir. see %s/examples" % (datadir, datadir)) 
        return
    logging.info("found %s credentials" % str(mod))
    return mod