S
S
S0ulReaver2012-04-28 14:48:37
Django
S0ulReaver, 2012-04-28 14:48:37

MetaWeblog API + Django?

At one time I had my own blog on WordPress, and used Windows Live Writer to post news. And I liked it so much that when I wrote down a self-written blog while studying Django, I wanted to add support for posting to it through Windows Live Writer (it solves the problem of convenient text formatting, it’s not convenient to do this in the Django admin panel, and it’s generally nice). It was useful to look for information on how to do this, I found out what is most convenient through the MetaWeblog API. Alas, there is really no Russian documentation (and everything is tight with English) - all I found was a couple of posts about organizing support for PHP and .NET, there is no knowledge of what is what. In addition, all this is complicated by the fact that I was practically not familiar with xmlrpc before.
Well, with grief on the floor, I found the xmlrpc server library for Django (django_xmlrpc), opened the MetaWeblog API specification, and started trying to organize at least something. And so this is what I have so far:

@xmlrpc_func(returns='string', args=['string', 'string', 'string',])<br>
def getUsersBlogs(appKey, username, password):<br>
    user = mw_authenticate(username, password)<br>
    return {'isAdmin': user.is_superuser,<br>
            'url': 'http://127.0.0.1:8000/',<br>
            'blogid': '1',<br>
            'blogName': 'MyWebBlog'}<br><br>
@xmlrpc_func(returns='string', args=['string', 'string', 'string'])<br>
def get_user_info(apikey, username, password):<br>
    user= mw_authenticate(username, password)<br>
    return {'userid': user.pk,<br>
           'email': user.email,<br>
           'nickname': user.username,<br>
           'lastname': user.last_name,<br>
           'firstname': user.first_name,<br>
           'url': 'http://127.0.0.1:8000/'}<br>

I tried to connect to the blog through Windows Live Writer - hooray, it seems to work! However, how it works ... It's not entirely clear to me in what sequence requests are sent to the server, but now I have this:
b201f876149cc2dd481e0f22d81a2a43.jpg
I understand that the rest of the methods have not yet been implemented, and it would be strange if it worked, and yet - as a result of such an error? Due to the lack of a specific method (but it seems like the rest of the methods are already specific to the post - editing - deleting, etc.)? Or is something wrong in the methods implemented above (logic suggests that they are, in theory, responsible for determining the presence of a blog on the server)? Alas, for example, why do I need a url with my English. I didn’t really understand, mb there’s a problem here ... In general, the question is even more general: are there people who have already organized the MetaWebBlog API + Django, and can such people set me on the right path, or share the code. I apologize for such stupid questions, but the programmer from me is very so-so.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question