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
- 8147 reads
SpeakingX












Recent comments
3 hours 50 min ago
9 hours 33 min ago
16 hours 11 min ago
1 day 7 hours ago
1 day 10 hours ago
1 day 10 hours ago
1 day 11 hours ago
1 day 11 hours ago
1 day 14 hours ago
1 day 15 hours ago