forked from device42/jamf_to_device42_sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjamf.py
28 lines (23 loc) · 921 Bytes
/
jamf.py
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
import requests
import json
class JamfApi:
def __init__(self, config, options):
self.auth = (config['username'], config['password'])
self.host = config['host']
self.debug = options['debug']
self.headers = {
'Content-Type': 'text/xml',
'accept': 'application/json'
}
def get_list(self, name):
return requests.get('https://%s/JSSResource/%s' % (self.host, name),
auth=self.auth,
headers=self.headers
# verify = False
).json()
def get_item(self, name, pk):
return requests.get('https://%s/JSSResource/%s/id/%s' % (self.host, name, pk),
auth=self.auth,
headers=self.headers
# verify = False
).json()