FORGE: Added including script
[myslice.git] / forge / script / PlcApi / getSites.py
1 #!/usr/bin/python
2 import xmlrpclib
3 import getpass
4 import Auth
5
6 plc_host='www.planet-lab.eu'
7
8 api_url="https://%s:443/PLCAPI/"%plc_host
9 plc_api= xmlrpclib.ServerProxy(api_url, allow_none=True)
10
11 siteId = raw_input("Give me the id of the site : ")
12 try:
13         siteId = int(siteId)
14 except Exception, why:
15         pass
16 print type(siteId)
17 sites = plc_api.GetSites(Auth.auth, [siteId], ['site_id', 'name', 'max_slices', 'slice_ids', 'node_ids', 'ext_consortium_id', 'login_base'])
18
19 i = j = 0
20 for site in sites:
21         if i <= 5:
22                 print site
23                 i+=1
24         else:
25                 j+=1
26
27 print "i = ",i," j = ",j