Blogger posting through gdata not working

4 views
Skip to first unread message

Tom 191

unread,
Jun 28, 2008, 2:26:14 PM6/28/08
to GData Python Client Library Contributors
I'm trying to follow the simple GData Python Blogger example:

http://code.google.com/apis/blogger/developers_guide_python.html

It's not working, however: I get an error message from the Google
servers.

I'm using the standard Ubuntu 8.04 install. I tried the svn version
of python-gdata with the same result. I also pulled over
wpttoblogger.py, someone else's code, and it, too, gives the same
result.

Does anybody know what's going on?

Tom

VERSION

Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

CODE

import gdata
from gdata import service
from gdata import atom

blogger_service = service.GDataService("foo","bar")
blogger_service.source = 'toms-test-0.1'
blogger_service.service = 'blogger'
blogger_service.server = 'www.blogger.com'
blogger_service.ProgrammaticLogin()
blog_id = '...'
entry = gdata.GDataEntry()
entry.title = atom.Title('xhtml',"hello, world")
entry.content = atom.Content('html','',"here's some content")
result = blogger_service.Post(entry,'/feeds/%s/posts/default'%blog_id)

RESPONSE

Traceback (most recent call last):
File "/tmp/py13044ui2", line 14, in <module>
result = blogger_service.Post(entry,'/feeds/%s/posts/
default'%blog_id)
File "/usr/lib/python2.5/site-packages/gdata/service.py", line 677,
in Post
media_source=media_source, converter=converter)
File "/usr/lib/python2.5/site-packages/gdata/service.py", line 805,
in PostOrPut
'reason': server_response.reason, 'body': result_body}
RequestError: {'status': 400, 'body': '[Line 2, Column 84, element
ns0:content] Malformed MIME type', 'reason': 'Bad Request'}

Tom 191

unread,
Jun 28, 2008, 2:30:46 PM6/28/08
to GData Python Client Library Contributors
I should say that I just tried running BloggerExample.py (from this
group's Files section) from the command line on two different machines
and I'm getting the same error message.

Tom

Takashi Matsuo

unread,
Jun 28, 2008, 8:28:56 PM6/28/08
to gdata-python-client-...@googlegroups.com
Hi Tom,

I think the BloggerExample.py is old one, and there is a newer version
of BloggerExample.py in the source tarball
(samples/blogger/BloggerExample.py). Perhaps you could try this new one.

hope it helps

Regards,

-- Takashi

Tom 191

unread,
Jun 29, 2008, 3:25:29 AM6/29/08
to GData Python Client Library Contributors
Thanks; you're right.

Google REALLY needs to update their documentation. It's frustrating
when Google's main documentation page for a project has examples in it
that don't work. I wasted a couple of hours on something that should
have been done in a few minutes.

Tom

Ryan Boyd (Google)

unread,
Jun 29, 2008, 3:25:17 PM6/29/08
to gdata-python-client-...@googlegroups.com
Hi Tom,

Our apologies - you're absolutely right.  I've audited the code in the blogger python dev guide and sent a changelsit for review.  The fixes should get committed and pushed live on Monday PDT.

Sorry for the problems, but thanks for sticking with it and providing the feedback.

-Ryan

Tom 191

unread,
Jun 29, 2008, 4:27:37 PM6/29/08
to GData Python Client Library Contributors
Thanks. An error in the Python GData API docs and examples was just
so unexpected, given that it's one of Google's most important APIs...
Reply all
Reply to author
Forward
0 new messages