Posted on 06-05-2015 06:18 AM
Just wondering how everyone using web help desk is getting the data from the mobile devices to sync.
We were using the API's to import the data and sync, using the sample python scripts in the JAMF SDK. However since the poodle SSL issue it looks like the python script has stopped working. Trying to now get around this issue:
Any ideas?
Gabe Shackney
Princeton Public Schools
Solved! Go to Solution.
Posted on 06-09-2015 06:35 AM
Nothing I know of changed, but looks like we found a work around with this xml:
#for Python 3.4 - Need to run this command to install requests library to python: pip install requests
import requests
import warnings
import time
warnings.filterwarnings('ignore')
print ("PPS XML Mobile Exporter for Casper Start")
#Open URL
#Using the URL, UserName, Password, and turning off the certificate verification since the certificate is self signed
#always test url with browser first.
url = "https://casper:8443/JSSResource/mobiledevices"
r = requests.get(url, auth=('USERNAME', 'PASSWORD'),verify=False)
xml = r.content.decode(encoding='UTF-8')
#Open URL
#File
#Creates a connection to an output file and write out the XML data and close the file
file = open("mobile1.xml", 'w')
file.write(xml)
file.close()
#File
#Over Write File
#This needs to be done, so we have a new blank file, since the file is appended with every run through the loop
file = open("mobile2.xml", 'w')
xml = ""
file.write(xml)
file.close()
#Over Write File
#Mobile 2 - A more detail report loop, to get more detail on each mobile device, as a short cut I loop through more times then we
#have mobile devices, since I only write a line out if the data is xml, if the id is not valid, an html file is returned and is ignored.
for count in range(1,20000):
x = str(count)
url = "https://casper:8443/JSSResource/mobiledevices/id/" + x + "/subset/General%26Location%26Purchasing"
r = requests.get(url, auth=('USERNAME', 'PASSWORD'),verify=False)
xml = r.content.decode(encoding='UTF-8')
xml = xml + "
"
if xml[:5] == "<?xml":
file = open("mobile2.xml", 'a')
file.write(xml)
#time.sleep(10)
file.close()
#Mobile 2 - More detail report
print ("PPS XML Mobile Exporter for Casper Finished")
Gabe Shackney
Princeton Public Schools
Posted on 06-07-2015 06:58 PM
I'm not using Web Help desk, but the API is the API.
Just tried the compexport_xml.py from the SDK. Seems to work as expected on my JSS (9.72) using the system Python 2.7.6 on 10.10.3.
Did you change anything with your certificates to patch SSL? Are you forcing SSLv3 in your version of the export script for some reason?
Posted on 06-09-2015 06:35 AM
Nothing I know of changed, but looks like we found a work around with this xml:
#for Python 3.4 - Need to run this command to install requests library to python: pip install requests
import requests
import warnings
import time
warnings.filterwarnings('ignore')
print ("PPS XML Mobile Exporter for Casper Start")
#Open URL
#Using the URL, UserName, Password, and turning off the certificate verification since the certificate is self signed
#always test url with browser first.
url = "https://casper:8443/JSSResource/mobiledevices"
r = requests.get(url, auth=('USERNAME', 'PASSWORD'),verify=False)
xml = r.content.decode(encoding='UTF-8')
#Open URL
#File
#Creates a connection to an output file and write out the XML data and close the file
file = open("mobile1.xml", 'w')
file.write(xml)
file.close()
#File
#Over Write File
#This needs to be done, so we have a new blank file, since the file is appended with every run through the loop
file = open("mobile2.xml", 'w')
xml = ""
file.write(xml)
file.close()
#Over Write File
#Mobile 2 - A more detail report loop, to get more detail on each mobile device, as a short cut I loop through more times then we
#have mobile devices, since I only write a line out if the data is xml, if the id is not valid, an html file is returned and is ignored.
for count in range(1,20000):
x = str(count)
url = "https://casper:8443/JSSResource/mobiledevices/id/" + x + "/subset/General%26Location%26Purchasing"
r = requests.get(url, auth=('USERNAME', 'PASSWORD'),verify=False)
xml = r.content.decode(encoding='UTF-8')
xml = xml + "
"
if xml[:5] == "<?xml":
file = open("mobile2.xml", 'a')
file.write(xml)
#time.sleep(10)
file.close()
#Mobile 2 - More detail report
print ("PPS XML Mobile Exporter for Casper Finished")
Gabe Shackney
Princeton Public Schools
Posted on 06-09-2015 06:58 AM
Glad to hear! I've been a big fan of the requests library as of late.