-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathget_computer.py
More file actions
38 lines (27 loc) · 1.12 KB
/
get_computer.py
File metadata and controls
38 lines (27 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import os
# nothing is packaged yet, and I'm trying to not depend on my custom
# environment vars for everthing, so.....
glpimodpath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0,os.path.split(glpimodpath)[0])
# now this part should work:
from GLPI import GLPIClient
if __name__ == '__main__':
import warnings
import getpass
import pprint
glpi = GLPIClient.Client('http://localhost/plugins/webservices/xmlrpc.php')
glpi.connect("glpi", "glpi")
print "\nGetting Computer\n"
pprint.pprint(glpi.get_computer(29))
print "\nGetting Help\n"
pprint.pprint(glpi.get_computer(29,help=True))
print "\nGetting Computer With All Options\n"
pprint.pprint(glpi.get_computer(29, id2name=True,
networkports=True, contracts=True ))
print "\nGetting with infocoms doesn't work for some reason, skipping\n"
# pprint.pprint(glpi.get_computer(29, id2name=True,
# networkports=True, contracts=True,
# infocoms=True))