Testing out Drupal's Service module using Python
Drupal's Services module seems to be a right fit for my purpose as I am in the process of integrating a desktop application into my Drupal website. I decided to give it a quick test using Python. Although I don't know much about Python, there's an example available on Drupal.org and it's a scripting language.
I downloaded the latest Python 2.6 and installed the latest Services module (5.x-0.92) on my 5.X Drupal site. Then I use the following script to test node.load service.
import xmlrpclib
url = "http://speakingx.com/services/xmlrpc"
drupal = xmlrpclib.ServerProxy(url)
res = drupal.system.connect()
node = drupal.node.load(res['sessid'],37,[])
print node
If you are using this to test your site, don't forget to set proper permissions, otherwise you'll get "access denied" error.
The above snippet uses node service besides the core service module. Therefore you'll need to enable anonymous access to the Service module as well as the node_service module.
- xjs's blog
- 2863 reads
SpeakingX












Recent comments
36 min 38 sec ago
39 min 41 sec ago
1 hour 13 min ago
1 hour 56 min ago
3 hours 25 min ago
3 hours 44 min ago
22 hours 35 min ago
22 hours 56 min ago
23 hours 3 min ago
1 day 40 min ago