Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Youtube Python API:登录状态_Python_Youtube Api - Fatal编程技术网

Youtube Python API:登录状态

Youtube Python API:登录状态,python,youtube-api,Python,Youtube Api,我正在使用示例代码登录youtube: def auth(email, password): # Setup service. yt_service = gdata.youtube.service.YouTubeService() yt_service.email = email yt_service.password = password yt_service.source = 'youtube_interface' yt_service.develop

我正在使用示例代码登录youtube:

def auth(email, password):
# Setup service.
    yt_service = gdata.youtube.service.YouTubeService()
    yt_service.email = email
    yt_service.password = password
    yt_service.source = 'youtube_interface'
    yt_service.developer_key = DEVELOPER_KEY

    # Login.
    yt_service.ProgrammaticLogin()

    return yt_service

请告诉我,我如何知道登录是否成功?如何注销

如果您正在用Python进行新的开发,我建议您改用API的v3。您正在使用的旧式Python客户机库已经有一段时间没有更新了,并且仍然与API的v1版本相冲突。下面是一些在v3中使用Python的代码示例


也就是说,为了回答您的问题,如果ClientLogin尝试失败,客户端库将引发一个错误。我不知道有什么方法可以通过编程使ClientLogin令牌“注销”无效。令牌将在几个小时后过期。

谢谢,我会试试看。我没有使用API的V3,因为标签“实验性”让我觉得有点不舒服。