AuthSub:(404,“未找到",“未知用户".) [英] AuthSub: (404, 'Not Found', 'Unknown user.')

查看:94
本文介绍了AuthSub:(404,“未找到",“未知用户".)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将Picasa API与AuthSub结合使用.我的代码:

I try to use Picasa API with AuthSub. My code:

GD_CLIENT = gdata.photos.service.PhotosService()

def login(request):
    def GetAuthSubUrl():
        callback = 'http://127.0.0.1:8000/callback'
        scope = 'https://picasaweb.google.com/data/'
        secure = False
        session = True
        return GD_CLIENT.GenerateAuthSubURL(callback, scope, secure, session)

    auth_sub_url = GetAuthSubUrl()
    return HttpResponseRedirect(auth_sub_url)


def confirm(request):
    authsub_token = request.GET['token']    
    token = GD_CLIENT.SetAuthSubToken(authsub_token)
    GD_CLIENT.UpgradeToSessionToken()
    GD_CLIENT.auth_token = token
    return direct_to_template(request, 'base.djhtml')


def add_album(request):
   form = AddAlbum(request.POST or None)
   if form.is_valid():
       data = form.cleaned_data
       title = data.get('title')
       summary = data.get('summary')
       GD_CLIENT.InsertAlbum(title=title, summary=summary)
       return HttpResponseRedirect('/get_albums/')
   return render(request, 'add_form.djhtml', {'form': form})

我在add_album上出错:

I got an error at add_album:

(404,未找到",未知用户".)

(404, 'Not Found', 'Unknown user.')

跟踪: get_response中的文件"/home/i159/Envs/photorulez/lib/python2.6/site-packages/django/core/handlers/base.py" 111. response =回调(request,* callback_args,** callback_kwargs) add_album中的文件"/home/i159/workspace/photorulez/photorulez/photoapp/views.py" 49. GD_CLIENT.InsertAlbum(title =标题,summary = summary) InsertAlbum中的文件"/home/i159/Envs/photorulez/lib/python2.6/site-packages/gdata/photos/service.py" 358.引发GooglePhotosException(e.args [0])

Traceback: File "/home/i159/Envs/photorulez/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "/home/i159/workspace/photorulez/photorulez/photoapp/views.py" in add_album 49. GD_CLIENT.InsertAlbum(title=title, summary=summary) File "/home/i159/Envs/photorulez/lib/python2.6/site-packages/gdata/photos/service.py" in InsertAlbum 358. raise GooglePhotosException(e.args[0])

异常类型:/add_album/的GooglePhotosException 例外值:(404,未找到",未知用户".)

Exception Type: GooglePhotosException at /add_album/ Exception Value: (404, 'Not Found', 'Unknown user.')

为什么提出?需要进行哪些更改?

Why is it raised? What changes are needed?

推荐答案

我明白了!!! GD_CLIENT = gdata.photos.service.PhotosService()需要email关键字参数作为Google帐户用户名.

I got it!!! GD_CLIENT = gdata.photos.service.PhotosService() needed email keyword argument as Google account user name.

gdata.photos.sevice.py

gdata.photos.sevice.py

class PhotosService(gdata.service.GDataService):
  ssl = True
  userUri = '/data/feed/api/user/%s'

  def __init__(self, email=None, password=None, source=None,
           server='picasaweb.google.com', additional_headers=None,
           **kwargs):

应该是:

GD_CLIENT = gdata.photos.service.PhotosService(email='username')

这篇关于AuthSub:(404,“未找到",“未知用户".)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆