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












Recent comments
4 hours 40 min ago
1 day 5 hours ago
1 week 1 hour ago
1 week 3 days ago
1 week 3 days ago
1 week 6 days ago
2 weeks 8 hours ago
2 weeks 3 days ago
2 weeks 5 days ago
2 weeks 6 days ago