jssimporter / python-jss

python-jss is deprecated. Please see the wiki for alternatives.
GNU General Public License v3.0
102 stars 41 forks source link

Fixed missing urllib quote module and python2 compatibility #92

Closed grahampugh closed 5 years ago

grahampugh commented 5 years ago

I came across a problem with the recent version of python-jss which was breaking certain AutoPkg/JSSImporter runs:

JSSImporter: python-jss version: 2.0.1.
JSSImporter: JSSImporter version: 1.0.2b3.
global name 'urllib' is not defined
Failed.

I did a global search of the python-jss project and the only direct call to urllib is in distribution_point.py. Looking at that file, urllib.quote is being called but there is no import urllib statement, so that won't work (using python2).

So I made a minor change to this file, adding quote as a module, and changing urllib.quote to quote. This fixed the problem of running the recipes on a Mac using python2.

@mosen, could you verify that it is correct for python3? I made the assumption that quote is in urllib.parse since unquote is...but I have also learned never to assume anything :)

grahampugh commented 5 years ago

Seems like it should be OK: https://stackoverflow.com/questions/31827012/python-importing-urllib-quote

grahampugh commented 5 years ago

Merging to master to resolve urllib issue.