diff --git a/jss/__init__.py b/jss/__init__.py index 773fa12..949141a 100644 --- a/jss/__init__.py +++ b/jss/__init__.py @@ -52,7 +52,6 @@ package. """ - from __future__ import absolute_import from .casper import Casper from .curl_adapter import CurlAdapter @@ -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 diff --git a/jss/auth.py b/jss/auth.py index f67678d..637e0b7 100644 --- a/jss/auth.py +++ b/jss/auth.py @@ -15,9 +15,12 @@ # along with this program. If not, see . 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__) @@ -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() - - - - diff --git a/jss/distribution_point.py b/jss/distribution_point.py index 3e13ebf..ae7fd79 100644 --- a/jss/distribution_point.py +++ b/jss/distribution_point.py @@ -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 diff --git a/jss/jamf_software_server.py b/jss/jamf_software_server.py index fd35649..fb7d9cf 100644 --- a/jss/jamf_software_server.py +++ b/jss/jamf_software_server.py @@ -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: diff --git a/jss/jssobjects.py b/jss/jssobjects.py index 7f9c456..9656d0b 100644 --- a/jss/jssobjects.py +++ b/jss/jssobjects.py @@ -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 diff --git a/requirements.txt b/requirements.txt index e593a18..bafffe2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/tests/test_nsurlsession_adapter.py b/tests/test_nsurlsession_adapter.py index efa0b4f..948f618 100644 --- a/tests/test_nsurlsession_adapter.py +++ b/tests/test_nsurlsession_adapter.py @@ -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