Search code examples
pythonbloggergdata

gdata autentication trouble python


I ran for awhile a python script to post articles on my blogspot blog. everything ran smoothly until I started to get this auth error

RequestError: {'status': 401, 'body': 'User does not have permission to create new post', 'reason': 'Unauthorized'}

I really can't understand how to fix it reading gdata documentation.

Could you please suggest me how to do?

Thank you

Here the part of my code that doesn't work anymore:

from gdata import service
import gdata
import atom
blogger_service = service.GDataService('xxxxxx','xxxxxx')
blogger_service.service = 'blogger'
blogger_service.account_type = 'GOOGLE'
blogger_service.server = 'www.blogger.com'
blogger_service.ProgrammaticLogin() 
def CreatePublicPost(blogger_service, blog_id, title, content,tags):
    entry = gdata.GDataEntry()
    entry.title = atom.Title('xhtml', title)
    entry.content = atom.Content(content_type='html', text=content)
    for tag in tags :
        category = atom.Category(term=tag, scheme="http://www.blogger.com/atom/ns#")
        entry.category.append(category)
    return blogger_service.Post(entry, '/feeds/%s/posts/default' % blog_id)

Solution

  • Now there is a API version 3.0...

    This old version is obsolete and no longer works, apparently...

    You can find more about it here: https://developers.google.com/blogger/ https://developers.google.com/blogger/docs/3.0/using/

    And if you have questions about authentication, maybe those links help:

    Having trouble trying to use gdata and oauth2 in python

    Authentication with the Google Docs List API, Python and OAuth 2