?

Log in

No account? Create an account
XML-RPC checkfriends silliness - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

XML-RPC checkfriends silliness [Dec. 14th, 2002|04:46 pm]
LiveJournal Client Discussions

lj_clients

[kumokasumi]
[mood |confusedconfused]

The XML-RPC interface doesn't seem to be sending back a "lastupdate" member in the struct returned from LJ.XMLRPC.checkfriends, which would seem to rather limit the method's usefulness, heh. I think the server's broken; it used to send it back and I don't know why it isn't now.

Here's what it looks like, with the xmlrpclib.py in debug mode:

<?xml version='1.0'?>
<methodCall>
<methodName>LJ.XMLRPC.checkfriends</methodName>
<params>
<param>
<value><struct>
<member>
<name>username</name><value><string>letoii</string></value>
</member>
<member>
<name>lastupdate</name><value><string></string></value>
</member>
<member>
<name>password</name><value><string>(sanitized for my protection.)</string></value>
</member>
<member>
<name>ver</name><value><int>1</int></value>
</member>
</struct></value>
</param>
</params>
</methodCall>

And the response:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member><name>new</name><value><int>0</int></value></member>
<member><name>interval</name><value><int>36000</int></value></member>
</struct>
</value>
</param>
</params>
</methodResponse>

The code definitely used to work; I first noticed it failing this week, but I hadn't used it for a while.
Anybody know what's going on? It almost looks like I'm getting the "no!-naughty-client!" response mentioned in the docs, but it does this even if I go days between running it.
linkReply

Comments:
[User Picture]From: markpasc
2002-12-14 11:56 am (UTC)

The docs (these, right?) don't say it's supposed to return one, but the definition for the lastupdate you send implies it does, certainly. Sounds like a bug in the docs to me, so I wonder if that's actually an old version of them.

Using xmlrpclib in a Python shell, I get a lastupdate. Why are you sending that ver parameter?

>>> x = xmlrpclib.Server("http://www.livejournal.com/interface/xmlrpc", verbose=1)
>>> resp = x.LJ.XMLRPC.checkfriends({'username':'markpasc', 'hpassword':hpasswd.hexdigest(), 'lastupdate':''})
connect: (www.livejournal.com, 80)
send: 'POST /interface/xmlrpc HTTP/1.0\r\n'
send: 'Host: www.livejournal.com\r\n'
send: 'User-Agent: xmlrpclib.py/1.0b4 (by www.pythonware.com)\r\n'
send: 'Content-Type: text/xml\r\n'
send: 'Content-Length: 432\r\n'
send: '\r\n'
send: "<?xml version='1.0'?>
<methodCall>
    <methodName>LJ.XMLRPC.checkfriends</methodName>
    <params><param><value><struct>
        <member>
            <name>username</name>
            <value><string>markpasc</string></value>
        </member>
        <member>
            <name>lastupdate</name>
            <value><string></string></value>
        </member>
        <member>
            <name>hpassword</name>
            <value><string>34cbbaa545d0d3d64029df519b2d7973</string></value>
        </member>
    </struct></value></param></params>
</methodCall>"
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Sat, 14 Dec 2002 22:46:05 GMT
header: Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.26
header: Content-Length: 352
header: Content-Type: text/xml
header: SOAPServer: SOAP::Lite/Perl/0.52
header: X-Cache: MISS from www.livejournal.com
header: Connection: close
body: '<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
    <params><param><value><struct>
        <member>
            <name>lastupdate</name>
            <value><string>2002-12-14 14:00:00</string></value>
        </member>
        <member>
            <name>new</name>
            <value><int>0</int></value>
        </member>
        <member>
            <name>interval</name>
            <value><int>45</int></value>
        </member>
    </struct></value></param></params>
</methodResponse>'
>>> resp
{'lastupdate': '2002-12-14 14:00:00', 'interval': 45, 'new': 0}
>>>

(Reply) (Thread)
[User Picture]From: phil99
2002-12-14 12:24 pm (UTC)
Did you mean to leave your user/pass in there? Or are you being cleverer than I thought?
(Reply) (Parent) (Thread)
[User Picture]From: markpasc
2002-12-14 12:51 pm (UTC)
Heh, no and no. I didn't think about the digest being visible in the output, just that I omitted where I typed it in. Thanks.
(Reply) (Parent) (Thread)
[User Picture]From: phil99
2002-12-14 01:57 pm (UTC)
Not that it matters a huge amount, I guess. Only just realised that "undigesting" is a pain in the ass.
(Reply) (Parent) (Thread)
[User Picture]From: kumokasumi
2002-12-14 02:03 pm (UTC)
But you don't actually need to "undigest" it to use it for API calls, do you? It doesn't change, after all.
(Reply) (Parent) (Thread)
[User Picture]From: phil99
2002-12-14 02:14 pm (UTC)
Clever... why didn't I think of it like that?
*shakes head sadly*
(Reply) (Parent) (Thread)
[User Picture]From: markpasc
2002-12-14 02:24 pm (UTC)
Yeah, but since there's no salt/etc hashed with the password, you could use that hashed password to do anything you liked with the XML-RPC or flat interfaces. Just not log in on the web site. I'm kind of curious why LJ doesn't do that (the client asks for a token, hashes token + password, sends the unreusable hash) other than complicating the process. Last I knew Jabber supports that, and as I understand it it's much safer (except the server has to keep an unhashed copy of the password).

I did have a nice memorable password set, but to be safe I quickly changed it to some random one I asked Password Safe for.
(Reply) (Parent) (Thread)
[User Picture]From: kumokasumi
2002-12-14 02:02 pm (UTC)
I was actually referring to the docs here, which appear to be a bit newer? but also don't mention the lastupdate field in the response. (Hmm. I thought they did, for some reason. Oh well.)

The ver parameter just says "UTF-8 is okay." It's mentioned in the docs I linked... it doesn't, alas, make a difference.

Perhaps the question here is, "why does LiveJournal hate me?" Is anyone else having problems with this, or do I need to just not check my friend list at all for 10 hours? o.o;
(Reply) (Parent) (Thread)
[User Picture]From: markpasc
2002-12-14 02:24 pm (UTC)
Ah, all right. I just Googled for it, since I remembered it wasn't linked from the Developer Area page.

Maybe it does hate you! I sure don't know. How are you seeing what XML you're sending and receiving?

And what's up with the "(required)" in the docs even on the optional parameters?
(Reply) (Parent) (Thread)
[User Picture]From: kumokasumi
2002-12-14 06:19 pm (UTC)
It's been linked from the Developer Area page for a couple months now, at least. That's how I found it. *shrug*

I'm looking at the XML by passing the verbose parameter to xmlrpclib like you did.
(Reply) (Parent) (Thread)
[User Picture]From: markpasc
2002-12-14 06:50 pm (UTC)
Ahhh, I always look at the "LiveJournal Server<->Client Protocol" link and click through to Protocol Mode Specs, whenever I'm looking for the flat mode details. I never realized the "Complete Protocol Docs" link had the XML-RPC docs too. Gah.

Oh, I figured you were using Perl or something. =) Really weird, then.
(Reply) (Parent) (Thread)