[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Demexp-dev] First XML RPC proxy available

From: David MENTRE
Subject: Re: [Demexp-dev] First XML RPC proxy available
Date: Sat, 09 Sep 2006 17:12:46 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

Hello Augustin,

Augustin <address@hidden> writes:

> The next stages for me are the following methods: get_timestamps() and the 
> different tagging methods.
> I know you are already working on them. 

I've worked on the XML RPC proxy and added following methods:

 - get_timestamps()
 - get_timestamps_decoded()
 - get_vote()
 - max_tag_id()
 - tag_info()
 - tag_set_of_question_group()
 - goodbye()

Those methods should be enough for you to consult the demexp server
(i.e. not act on it: vote, management, ...). The CGI on tuxinette is

Now, some explanations.

In all the following, 'cookie' is the value returned by login() RPC

 * goodbye(cookie)

   To close the current connection opened with login(). It is *strongly*
   recommended to do a goodbye() for each login(). 

   If you want to act as anonymous user, do not make a call to login()
   and use 0 (zero) as cookie.

   This call returns True because I don't know how to return a void
   value with XML RPC.

 * get_timestamps() and get_timestamps_decoded()

   get_timestamps(cookie) returns the latest timestamp for tags,
   participants and question. This RPC calls the raw binary timestamp
   interface that returns three gzipped array of 32 bits unsigned big
   endian integers, one integer for each tag, participant or
   question. The greater the integer, the fresher is the corresponding

   I assume that this binary interface might be a little difficult for
   you to use at first, so I have added get_timestamps_decoded(cookie)
   RPC method. This call is the same as the previous one, except it
   returns the set of the three arrays already decoded (i.e. ungzipped
   and binary value transformed into XML counterpart). This works *but*:

    - it adds a very big network overhead;

    - XML RPC integers are limited to /signed/ 32 bits integer, while we
      use /unsigned/ ones. So one day or the other, the interface *will*
      break. On the same front, I already noticed that some participants
      tags are negative (i.e. bigger than 2^31) but that should not
      happen. Probably the base is corrupted on that side.

   In order to limit network overhead, maybe I should implement
   get_timestamps_questions_decoded(), get_timestamps_tags_decoded(),
   etc. ?

    => 19866356

    Question #261 as currently timestamp value 19866356.

 * get_vote(cookie, question_id, login)

   This RPC returns the user's own vote (as a list on integers) on
   question number QUESTION_ID. The cookie should come from a successful
   login(). The LOGIN value is the same as used in login() method.

    get_vote(cookie, 0, "demo")
    => [1, 3]

    In this example, user "demo" as voted responses 1 then 3 for
    question #0.

 * max_tag_id(cookie)

   Similar call to max_question_id(), returns the greatest tag number.

 * tag_info(cookie, base, number)

   Similarly to question_info(), returns the details of tags (label, tag
   number, timestamp, ...) for NUMBER tags starting at BASE. An array is

    => [{'a_tag_label': 'droits fondamentaux', 'a_tag_timestamp': 0, 
'a_tag_id': 1},
        {'a_tag_label': 'demexp', 'a_tag_timestamp': 0, 'a_tag_id': 0}]

    In this example, tag #0 has label "demexp" and timestamp 0.

 * tag_set_of_question_group(cookie, base, number)

   Returns, for each question, the set of tag ids attached to it, for
   NUMBER questions, starting at BASE. It returns an array of items, for
   each one of them, the question identifier and the corresponding list
   of tag ids (as integers).

   An example:
    tag_set_of_question_group(cookie, 0, 2)
    => [{'tag_set_qid': 1, 'tag_set': [70, 1]}, {'tag_set_qid': 0, 'tag_set': 
[70, 0]}]

    In this example, question id #1 has tags #70 and #1; question #0 has
    tags #70 and #0. Use tag_info to get the label of tags.

All those calls should fulfil your needs to replicate on the web the
state of the demexp server. Let me know if you have an issue or

provides an example of XML RPC call in Python.

Regarding the implementation of modifying methods (i.e. vote, add new
users, ...), I tried to implement the vote() RPC. Currently this method
fails with a strange error and I don't know why. :-(

Best wishes,
GPG/PGP key: A3AD7A2A David MENTRE <address@hidden>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A

reply via email to

[Prev in Thread] Current Thread [Next in Thread]