This repository was archived by the owner on May 28, 2025. It is now read-only.
Releases: jssimporter/python-jss
Releases · jssimporter/python-jss
2.1.1
- Changed the mount point from
/Volumesto/Users/Shared. This is to address failing mount points on macOS Big Sur.
2.1.0
Added
- Retained compatibility with AutoPkg 1.x (Python 2) while adding compatibility for AutoPkg 2.x (Python 3).
- Added
$to safe characters in URLs to allow hidden shares (#169).
Changed
- Brought in latest upstream changes from FoundationPlist and GURL.
Start Choppin' Pre-Release
After the 1.x series, @sheagcraig completely rewrote sections of the python-jss library.
These are his original notes for Start Choppin'
Added
CurlAdapter,ResponseAdapter, andRequestsAdapterto wrap curl in
requests' API. This is primarily to deal with the fact that Apple's shipped
OpenSSL is extremely out of date (requests uses pyopenssl, which uses the
out-of-date OpenSSL). Since current recommendations from Jamf are to run the
Casper server using only TLS1.2, this puts us in a bind. So, by default,
python-jss will now use curl for networking. Developers seeking the
advantages of using requests can replace the networking adapter they want to
use (seejss.jamf_software_server.JSS). note: because i added requests back in, this is less important - mosen.- @mosen really stepped up and provided Sphinx documentation! This is a great
motivator for getting some improved documentation going for this project. JSSObjectand all of its subclasses can now be used as a context manager
(the pythonwithstatement). All this does is automatically tries to save
the object automatically on the way out of the with context.Container.__contains__magic method, which allows you to do things
likeif some_pkg in some_policy:. Please note, this will find any
reference to that object contained within. This may not be what you want, for
example, if a computer is in a group's exclusions list but you want to know
if it's in the inclusion list. Thankfully, there's a method for that
(JSSGroupObject.has_member()).JSSObjectmagic methods for equality and hash. This means you can
test whether twoComputerobjects are the same, for example. You can also
now use the objects as keys in a dictionary, or other mapping.- Implemented new endpoints and their corresponding objects:
AllowedFileExtension,ComputerApplicationUsage,ComputerApplication,
ComputerHardwareSoftwareReport,ComputerManagement,HealthcareListener,
HealthcareListerRule,JSONWebTokenConfigurations,
InfrastructureManager,MobileDeviceHistory,Webhook. - Added compression argument to
JSS.pickle_all()(defaults toTrue) to
compress pickle output. A lot. - Tag access through the
.operator forJSSObjects. For example, you can
now docomputer.configuration_profiles.size.textto reach all the way down
the tree to that value. - All
JSSObjects have atree()method which will return a nicely indented
representation of the tag structure of the object. Use it like this:print a_computer_group.tree(). - Automatic
matchsearch detection for object types that support it. Now you
can doj.Computer("MacBook*")instead ofj.Computer("match=MacBook*").
Match searches will always return a QuerySet. JSS.version()method now returns the server's version (using the jssuser
endpoint.- Made the
DistributionPointscollection class iterable, so if you do need to
operate on individual DPs within, you don't need to fool around with the
private collection. (See JSSImporter for an example). - Added
Script.add_script()to handle XML escaping and adding a script
payload to aScriptobject.
Changed
- Moved the
suppress_warningspreference out ofJSSand into the requests
adapter. TheJSSinitialization will accept that keyword argument to ease
the (sudden) deprecation, but it just won't do anything. Use the
RequestsAdapter.suppress_warnings()method if you need it. - Instantiating a
JSSobject will now default to using theCurlAdapterfor
networking. UseJSS.mount_networking_adapter()to replace it with the
RequestsAdapterand gain things like sessions. - The requests library is now not a required dependency. You only need it if
you want to import/use theRequestsAdapter. - Through some metaprogramming shenanigans, jss.JSS is now about 500 lines
shorter, from dynamically creating all of the object search methods. This
makes maintenance of this code significantly easier. - All object search methods accept keyword arguments (instead of a
subset
positional argument). Whether the JSS is considered to work with subsetting
is recorded as a new attribute on the class (jss.Computer.allowed_kwargs = Truefor example). This, again, makes it easier to maintain as JAMF adds or
removes query features. The search methods docstrings all reflect the level
of (considered) support. JSSObjectListis now called aQuerySet, inspired by Django. The old
behavior was that the contents were just id/name for each contained object,
until you used the "retrieve" method. Now all objects contained within are
full JSSObjects.- python-jss was using
reprandstrtoo casually. Throughout, class'repr
has been rewritten to provide a very basic marker of the type, andstrhas
been written to provide the pretty-printing of XML functionality that it had
previously. In practice, this means that in the interpreter, developers will
have toprint xinstead of just enteringxto see what they have.
However, it also means that simply doingxgives easier to read information
for QuerySets of items without dumping their entire contents to screen (e.g.
j.Computer()results in thousands of lines vomited into your terminal). - Renamed some internal classes (
JSSContainerObject->Container,
JSSGroupObject->Group) Containerand all of its subclasses (most types of data from the JSS) now
use lazy-loading to defer sending a GET method until you actually need the
data.- All
Elementobjects added to aJSSObjectwill get converted to the
PrettyElementtype to enable dot access and pretty printing. - Renamed all of the request-failure exceptions by dropping the
JSS:JSSGetError->GetErrorJSSPutError->PutErrorJSSPostError->PostErrorJSStDeleteError->DeleteError
Deprecated
JSSObjectListhas been renamed to QuerySet and now inherits from it. While
it is unlikely that any client code directly references this class, it is
worth checking for in your code. It will be remmoved entirely in a future
release. Please update code to use the QuerySet API and signature.
Removed
- All references to the
jss_migratedpreference has been removed. This is no
longer an issue with current and future JSS versions. - Scripts stopped being stored on distribution points with the conclusion
of version 8, so all distribution point code that did script copying,
deletion, existence testing, etc, has been removed. JSSObjectList.retrieve()has been removed as it's no longer needed.JSSObjectList.pickle()andfrom_pickle(). This code is just cruft; it's
just about the same amount of work to pickle it on your own.JSSObjectFactorywas removed as it is no longer needed. Client code should
usegetattrif it needs to dynamically choose which class to use.JSSDeviceObjectwas removed as it was no longer needed. It only added a
udidandserial_numbermethod to two subclasses,Computerand
MobileDevice. You can access these through.notation now:
computer.general.serial_number.text- As a result of
.access to subelements, all properties doing the same thing
have been removed. The vast majority of these were inPolicy(e.g.
a_policy.computersis now accessed througha_policy.scope.computers). - Removed a bunch of spurious internal-use-only exceptions and used the builtin
ones that make more sense.
Fixed
- Made
JSS.userandJSS.passwordproper properties, that will set the
attached network adapter appropriately. - Unicode and bytes usage throughout has been audited and fixed. For the most
part, developers can pass either to classes or methods and when they need to
get converted, python-jss will do the right thing. - Removed pretty-printing injection from
ElementTree.
1.5.0 Brick House
Added
- Added optional
actionargument toPolicy.add_package. Now you can specify that you want to "Cache", "Install Cached", or "Install". Uses "Install" by default. (#48) - Added
CommandFlushobject (new endpoint in JSS API). - Added
LogFlushobject (new endpoint in JSS API). - Added
Patchobject. - Added
VPPAssignmentobject (untested at this time). - Added
VPPInvitationobject (untested at this time). - Added
JSSObject.to_stringandJSSObject.to_filemethods to JSSObject. - Added
JSSObject.pickleandJSSObject.from_picklemethods. - Added
JSSObjectList.pickleandJSSObjectList.from_pickle. - Added category search to
Policy. (#50 Thanks @jlrgraham) - Added stub objects. With these new endpoints, the Casper API now allows multiple parameters in a single URL (aside from the
subsetparam). As I have limited development time for this project, these endpoints have stub objects added, but noJSShelper method, testing, or easy import withimport jss. The TODO list has an item to add an ability to handle an arbitrary number of keyword arguments to a a GET request to support these new endpoints. Until then, the following objects serve as placeholders:- Added
ComputerApplicationobject (untested at this time). - Added
ComputerApplicationUsageobject. - Added
ComputerHardwareSoftwareReportobject (untested at this time). - Added
ComputerHistoryobject (untested at this time).
- Added
Changed
JSSObjectList.retrieve_allnow returns aJSSObjectListinstead of a list. This is to support being able to pickle/unpickle the contained objects all at once.JSSObject.from_stringencodes input to utf-8 now. ElementTree.fromstring doesn't accept unicode, so anything outside of ascii throws an exception. (#44 Thanks @systemheld!)- SMB now defaults to port 445 (#51 #53 Thanks @ChrOst)
Fixed
1.4.0: The Final Countdown
Added
- Added retrieve method to
JSSListData, making the retrieval of individualJSSObjectListelements more flexible. - Added some argument type checking.
- Added lots of documentation.
- Re-enabled the ability to create new objects with the JSS convenience methods (e.g.
jss.JSS.Computer) - Added and improved the verbose output for HTTP requests.
- Added a repr to
JSSListDataso you can now better interact with them. - Added the
suppress_warningskey to the preference domain andJSSPrefsobject. - Added an interactive configuration procedure to the JSSPrefs class. If you don't already have a plist file, on instantiation it will prompt your for all configuration information.
- Added a
pre_callbackandpost_callbackparameter toDistributionPoints.copy. This allows you to provide some feedback for long copying operations. In the future, if desired, more may be added to long-running methods likeJSSObjectList.retrieve_all(). - Added a LocalRepository repo type for paths either local or already mounted. Required connection args are "mount_point", "share_name", and if migrated, "jss".
- Added some public methods to
JSSObjectFactoryif you're into doing some lower-level object searching and creation.
Changed
- Optimized
JSSObjectList.retrieve_all. - Reorganized
JSSObject.savemethod. It was very convoluted. Now it reads better, is more error resistant, and should work exactly the same. Specifically, it assumes that if your JSSObject has no ID, then it is a new object (because only the JSS can assign one) and thus needs to PUT. If it does have an ID, then it POSTs it. Potentially this could be an issue where if you retrieved an object, and then wanted to completely replace it with different data, and then tried to save, it would then be missing the ID and would PUT, creating a new object (or fail because of the name conflict); I don't see that as a real issue though. - Removed
JSSObject.searchsince it implements a deprecated Element
method that wasn't being used anywhere. - Restored requests method of posting FileUploads. Now uses mimetypes to
detect file type and uses it in header. - JAMF fixed D-008180, where the JSS rejected Packages and policies with
a category of "No Category Assigned", even though that's what the JSS
supplied in GET requests. This was fixed in JSS v9.7. Therefore,
python-jss removed its overriden methodsPackage.saveand
Policy.save. It's likely this was broader than just Packages and
Policies, but python-jss hadn't implemented or tested other objects. - Internal package structure drastically changed to make modules smaller and more manageable.
- Improved the formatting of
JSSObjectListobjects. - Replaced the Element.repr method with the indenting pretty-printing one that has been in python-jss for awhile now. This allows all non-assigned results from Element subclass methods to pretty-print the XML.
- Removed the recently added
JSSObject.pretty_findas it's no longer needed. - Changed the method for creating "new" JSSObjects. Now, generating a blank XML for JSSObjects uses a class attribute
data_keysto generate the structure. It allows for setting default values.- Now, the
__init__and_newmethods accept any of thedata_keysas keyword args to be set during creation.
- Now, the
- Renamed
JSSObject.newtoJSSObject._newto discourage client use.
Fixed
JSSObject.set_boolimproved to not have broken string behavior.
1.3.0: Two Men Enter, One Man Leaves
Added
- Added the subset feature to object queries that support it. For example Computers allow you to do
jss_connection.Computer(None, "basic") for extended list information orjss_connection.Computer("computer-name", "general&purchasing")orjss_connection.Computer("computer-name", ["general", "purchasing"])for subsection retrieval. This should allow you to speed up bigretrieve_all` runs significantly. - Added Cloud Distribution Point support. Thanks to @beckf for packet analysis help, and @homebysix for testing. (#22)
- Added
JSSObject.pretty_find. Pretty prints sub-elements of a JSSObject for use in interactive exploration of the JSS. - Added option
verifytoJSSPrefsand the com.github.sheagcraig.python-jss preference domain. If not specified in the preferences, it will assumeTrue. - Added property to
JSSGroupObjectand subclasses foris_smart. Now you can have a regular boolean property and setter for groups. - Added method
is_membertoJSSGroupObject. This allows you to test whether a Computer or MobileDevice object is a member of a group.
Changed
- New mount technique uses PyObjC rather than subprocess to mount. Thanks to @pudquick for this slick implementation!
- Solves some Kerberos issues some users were experiencing.
- For OS X users who are not using the Apple Python, continue to use subprocess to mount.
- The nobrowse argument to mount is now deprecated, and will do nothing. It will be removed entirely in the future.
- Verbose prints mount arguments.
- When viewing object data interactively, the
__repr__now displays simply*data*instead of the full binary data for things like icons and app binaries.
Fixed
- Encode data arguments to
JSSobject's get method. - Quote data arguments to
JSSobject's get method, since apparently requests doesn't do this for us.
Removed
- Removed
JSSGroupObject.set_is_smart. (Replaced with@property)
1.2.1: U0001F49A
Fixed
- Restated cipher list to solve #42 and jssimporter/JSSImporter#44. Thanks to @rtrouton for extensive testing patience.
1.2.0: Your Cipher is all Over my Necktie
Changed
jss.ComputerGroups that are made with thenewmethod now include thecomputerssubelement. Strangely, even smart groups include a computers tag. If previously populated with computer objects, it will retain them!- Removed bundled copy of python requests.
- Using setuptools
setup.pypropertyinstall_requiresto specify dependencies:- requests
- pyasn1
- ndg-httpsclient
- Previous two required for cipher change support.
- Updated documentation to describe this requirement for developer (i.e. anyone who does not use the egg or wheel files to install).
JSS.base_url(Get and Set) andJSS._url(Read only) are now proper properties.
Fixed
- Changes the default cipher list for requests/urllib3 to work with recommended changes in JSS >= v9.73.
jss.JSS.ssl_verifyis now a computed property and will properly update the requests session if changed after instantiation.- casper package's
Casperclass did not use the requests session on the JSS object passed to it. - JSS URL's with a trailing slash will be sanitized to remove that slash upon JSS instantiation or
base_urlupdate.
1.1.0: Velvet Nachos
Changed
Package.newnow sets theboot_volume_requiredproperty totrueby default.
1.0.2: When Doves Cry
Fixed
MobileDeviceGroupnow correctly inherits fromJSSGroupObject.