</section>
<section id="numeric">
- <title> Nueric comparisons </title>
+ <title> Numeric comparisons </title>
<para> Strictly greater/smaller operations are achieved by prepending the field name like in:
<programlisting>GetEvents( { '>time' : 1178531418 } ) </programlisting>
</para>
nodes = plc.GetNodes([121], ['node_id', 'hostname'])
</programlisting>
</section>
+
+ <section id='standalone'>
+ <title>Using regular python</title>
+
+ <para>It is also possible to write simple regular-python scripts,
+ as illustrated in the example below. The only difference with the
+ examples above is that all API calls need to be passed a first
+ argument for authentication. This example would write in a file
+ the name of all the hosts attached to a given slice.</para>
+
+<programlisting>
+#!/usr/bin/env python
+
+import xmlrpclib
+
+plc_host='www.planet-lab.eu'
+login='thierry.parmentelat@sophia.inria.fr'
+password='xxxxxxxx'
+
+slice_name='inria_heartbeat'
+
+auth = { 'AuthMethod' : 'password',
+ 'Username' : login,
+ 'AuthString' : password,
+}
+
+api_url="https://%s:443/PLCAPI/"%plc_host
+
+plc_api = xmlrpclib.ServerProxy(api_url,allow_none=True)
+
+# the slice's node ids
+node_ids = plc_api.GetSlices(auth,slice_name,['node_ids'])[0]['node_ids']
+
+# get hostname for these nodes
+slice_nodes = plc_api.GetNodes(auth,node_ids,['hostname'])
+
+# store in a file
+f=open('mynodes.txt','w')
+for node in slice_nodes:
+ print >>f,node['hostname']
+f.close()
+</programlisting>
+ </section>
+
</chapter>
<chapter id="Methods">