auth.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:AutoUploaderGoogleDrive 作者: siorai 项目源码 文件源码
def Service_Account_Credential():
    """
    Utilizes the Service Account Credential flow to instantiate an authorized credentials
    object for calling the Google API
    """
    logging.debug('DEBUG: SAC_FLOW: Attemping to load settings file from %s' % settings.servicekeyfile)
    keyfile = settings.servicekeyfile
    logging.debug('DEBUG: SAC_FLOW: Finished loading Service Account Keyfile: using %s' % keyfile )
    logging.debug('DEBUG: SAC_FLOW: Loading scopes from settings file')
    scopes = settings.scopes
    logging.debug('DEBUG: SAC_FLOW: Finished loading scopes from settings file')
    logging.debug('DEBUG: SAC_FLOW: Initializing credential from oauth2client.service_account')
    credentials = ServiceAccountCredentials.from_json_keyfile_name(keyfile, 
                        scopes=scopes)
    logging.debug('DEBUG: SAC_FLOW: Delegating credentials from settings')
    delegated_credentials = credentials.create_delegated(settings.delegated_email)
    logging.debug('DEBUG: SAC_FLOW:Initializing authorized, delegated credentials object')
    http = delegated_credentials.authorize(httplib2.Http())

    return http
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号