The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 16, 2019, 11:18:04 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: xml-rpc post to livejournal in python  (Read 3093 times)
arms
Expert
****
Offline Offline

Posts: 235



View Profile
« on: November 22, 2007, 09:40:23 AM »

xmlrpc is really easy in python.
nop_90 already pointed out how you just create an object and call the xml-rpc methods on the object itself.

to post to a livejournal blog:

Code:
import xmlrpclib
import datetime

server = xmlrpclib.ServerProxy("http://www.livejournal.com/interface/xmlrpc")
now = datetime.datetime.now()
# the livejournal xml-rpc reference: http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.postevent.html
# defines the args for the postevent method as a 'struct' which translates to a dictionary in python
args = {"username" : "username",
        "password" : "password",
        "event" : "They dyed me this color! That's how clever they are!",
        "subject" : "I'm thinking with sand here",
        "year" : now.year,
        "mon" : now.month,
        "day" : now.day,
        "hour": now.hour,
        "min" : now.minute
}
# call the remote method as a method of the server object
response = server.LJ.XMLRPC.postevent(args)
print response
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!