Skip to content

Commit

Permalink
Add system path to /Library/AutoPkg/JSSImporter where we put requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Pugh committed Jan 20, 2020
1 parent f9aaa5c commit a828b17
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
11 changes: 4 additions & 7 deletions jss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
package.
"""


from __future__ import absolute_import
from .casper import Casper
from .curl_adapter import CurlAdapter
Expand All @@ -70,12 +69,10 @@
from .queryset import QuerySet
from .pretty_element import PrettyElement

# If a system doesn't have the required dependencies for requests, do
# nothing.
try:
from .requests_adapter import RequestsAdapter
except ImportError:
RequestsAdapter = None
import sys

sys.path.insert(0, '/Library/AutoPkg/JSSImporter')
import requests

from .tools import is_osx, is_linux, element_str

Expand Down
9 changes: 4 additions & 5 deletions jss/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import
import requests
from datetime import datetime
import logging
import sys

sys.path.insert(0, '/Library/AutoPkg/JSSImporter')
import requests

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -60,7 +63,3 @@ def handle_401(self, r, **kwargs): # type: (requests.Response, dict) -> request

logger.debug("Server returned HTTP 401, getting a new token")
self._get_token()




4 changes: 3 additions & 1 deletion jss/distribution_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import shutil
import socket
import subprocess
import sys
import io
import math
import multiprocessing
import threading
import requests

sys.path.insert(0, '/Library/AutoPkg/JSSImporter')
import requests

try:
# Python 2.6-2.7
Expand Down
4 changes: 3 additions & 1 deletion jss/jamf_software_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
except ImportError:
import _pickle as cPickle # Python 3+


import sys
import gzip
import os
import platform
import re
import json
from xml.etree import ElementTree

sys.path.insert(0, '/Library/AutoPkg/JSSImporter')
import requests

try:
Expand Down
1 change: 1 addition & 0 deletions jss/jssobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from xml.etree import ElementTree
from xml.sax.saxutils import escape

sys.path.insert(0, '/Library/AutoPkg/JSSImporter')
import requests

from .queryset import QuerySet
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pluggy==0.6.0
py==1.5.4
pytest==3.6.3
pytest-docker==0.6.1
requests==2.19.1
requests==2.22.0
six==1.11.0
urllib3==1.24.2
sphinx==1.5.3
3 changes: 3 additions & 0 deletions tests/test_nsurlsession_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from __future__ import absolute_import
import pytest
import sys

sys.path.insert(0, '/Library/AutoPkg/JSSImporter')
import requests

from xml.etree import ElementTree
try:
from jss.nsurlsession_adapter import NSURLSessionAdapter, NSURLCredentialAuth
Expand Down

0 comments on commit a828b17

Please sign in to comment.