Re: post blog using python API

John Wood <[email protected]>
Newsgroups gmane.comp.web.blogger.api
Message-ID <CAPtEm2Stt-80GajVMc4MnbakZ24R+tTWDnQYN3p1gL=VXxZZtg@mail.gmail.com>
Tom,

if the github didn't bring in the latest version, the only thing I can
suggest is

sudo pip install --upgrade gdata

That definitely brought in a new version for me.

I'm the same, just using blogger for my own stuff, so the oauth seems far
too complicated for what I'm doing.

my own login sequence is slightly different to yours

import gdata.blogger.service

 def _login (self) :
        ''' login to Blogger '''

        self._gdclient = gdata.blogger.service.BloggerService
(source=self._source)
        try :
            self._gdclient.ClientLogin (self._user, self._password,
source=self._gdclient.source)
            self._debug ("logged in to Blogger")
            self._loggedin = True
        except etc.

They're deprecating ClientLogin, but it still seems to work just now. May
be worth trying that rather than ProgrammaticLogin


John

On 1 July 2015 at 07:44, Tom <[email protected]> wrote:

> Hi John,
>
> Thanks for your suggestion. I am using the API in google app engine for
> myself.
> I download gdata from https://github.com/google/gdata-python-client , but
> still got the same error.
>
> Since I am just using the API to post blog for myself, oauth seems to
> complicated to me.
> I have try to read Google docs, but still can't find out how to do it.
>
> Do you know where to get the latest gdata package?
>
> Thanks,
> Donghua
>
>
> On Wednesday, July 1, 2015 at 8:27:36 AM UTC+8, John Wood wrote:
>>
>> I believe the correct way is to switch to using oauth2.
>>
>> However, I found that updating the gdata libary from Google fixed a
>> similar issue for me - although I'm not sure for how long.
>>
>> on linux it was just
>>
>> sudo pip install --upgrade gdata
>>
>> if that doesn't work, try
>>
>> sudo pip install --upgrade google-api-python-client
>>
>> as well. I did both while working on this recently, but I think it was
>> just the first one that mattered.
>>
>> oauth makes my head hurt, so I'm trying to avoid those changes for as
>> long as possible. That and the picasaweb api doesn't seem to have been
>> updated, and I need that one as well
>>
>> On 30 June 2015 at 08:35, Tom <[email protected]> wrote:
>>
>>> Hi Experts,
>>>
>>> I find a script to keep update my blog using python API failed with
>>> message:
>>>
>>> {'status': 401, 'body': 'User does not have permission to create new post', 'reason': 'Unauthorized'}
>>>
>>> I am using following code:
>>>
>>>   #email = "email--addr--###gmail.com"
>>>   #password =  "PassWord"
>>>   #blog_id = "2711*********08"
>>>
>>>
>>>   blogger_service = gdata.service.GDataService(email, password)
>>>   blogger_service.source = 'exampleCo-exampleApp-1.0'
>>>   blogger_service.service = 'blogger'
>>>   blogger_service.account_type = 'GOOGLE'
>>>   blogger_service.server = 'www.blogger.com'
>>>   blogger_service.ProgrammaticLogin()
>>>
>>>   entry = gdata.GDataEntry()
>>>   entry.title = atom.Title('xhtml', title)
>>>   entry.content = atom.Content(content_type='html', text=blog_content)
>>>
>>>   return blogger_service.Post(entry, '/feeds/%s/posts/default' % blog_id)
>>>
>>> This works for the past several years, but failed from June 22.
>>> What should I do to fix the issue?
>>>
>>> Thanks,
>>> Tom
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Blogger Developer Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/bloggerdev.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Blogger Developer Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/bloggerdev.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/bloggerdev.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.