def __init__(self, db_filename=None):
credentials = GoogleCredentials.get_application_default()
scoped_credentials = credentials.create_scoped(
['https://www.googleapis.com/auth/cloud-platform'])
http = httplib2.Http()
scoped_credentials.authorize(http)
self.service = discovery.build('language', 'v1',
http=http,
credentials=credentials)
# This list will store the entity information gleaned from the
# image files.
self.entity_info = []
# This is the filename of the sqlite3 database to save to
self.db_filename = db_filename or 'entities{}.db'.format(
int(time.time()))
评论列表
文章目录