[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: |
Sun, 03 Sep 2006 18:52:17 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
David MENTRE <address@hidden> writes:
> Augustin, using max_question_id() and question_info() with a value of 0
> (zero) as cookie, you should be able to get details on questions and
> write your Drupal code. Let me know of any issue. In the meantime, I'll
> try to extend that code.
>
>>>> from xmlrpclib import *
>>>> s = ServerProxy("http://www.linux-france.org/cgi-bin/demexp-xmlrpc-demo")
>>>> s.max_question_id(0)
> 270
>>>> s.question_info(0, 0, 1)
Ok, I've already modified the API: it simplifies the proxy and will
easier error handling on the XML RPC side. Now returned structures are:
>>> from xmlrpclib import *
>>> s = ServerProxy("http://www.linux-france.org/cgi-bin/demexp-xmlrpc-demo")
>>> s.max_question_id(0)
{'max_question_id': 270, 'max_question_id_rc': 200}
>>> s.question_info(0, 0, 1)
{'question_info_rc': 200, 'question_info': [{'q_id': 0, 'q_info_num_votes': 21,
'q_info_limit_date': 0, 'q_desc': 'Est-ce que vous trouvez demexp utilisable
?', 'q_info_elected_responses': [2], 'q_timestamp': 24115814, 'q_info_status':
2, 'q_info_responses': [{'r_info_desc': 'Question rejected', 'r_info_link':
''}, {'r_info_desc': u'Ind\xe9cis', 'r_info_link': ''}, {'r_info_desc': 'Oui',
'r_info_link': ''}, {'r_info_desc': 'Non', 'r_info_link': ''}, {'r_info_desc':
u'm\xeame le dimanche?', 'r_info_link': ''}, {'r_info_desc': 'oui',
'r_info_link': ''}, {'r_info_desc': u'Uniquement avec un \xe9cran large',
'r_info_link': ''}, {'r_info_desc': 'A qd la langue francaise ?',
'r_info_link': ''}, {'r_info_desc': 'NON', 'r_info_link': ''}, {'r_info_desc':
'Difficile pour un non informaticien', 'r_info_link': ''}]}]}
For each returned data structure, there is a field _rc at the toplevel
(max_question_id_rc, question_info_rc, ...). This is the return
code. 200 is ok, otherwise there is an error. See demexp protocol
description for description of error codes.
Best wishes,
d.
--
GPG/PGP key: A3AD7A2A David MENTRE <address@hidden>
5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A