Pass HttpBasicAuth object to requests, rather than a list, which it didn't understand
This commit is contained in:
@@ -60,10 +60,10 @@ class XQueueInterface:
|
||||
Interface to the external grading system
|
||||
'''
|
||||
|
||||
def __init__(self, url, django_auth, basic_auth=None):
|
||||
def __init__(self, url, django_auth, requests_auth=None):
|
||||
self.url = url
|
||||
self.auth = django_auth
|
||||
self.session = requests.session(auth=basic_auth)
|
||||
self.session = requests.session(auth=requests_auth)
|
||||
|
||||
def send_to_queue(self, header, body, file_to_upload=None):
|
||||
'''
|
||||
|
||||
@@ -19,14 +19,20 @@ from xmodule_modifiers import replace_static_urls, add_histogram, wrap_xmodule
|
||||
|
||||
from courseware.courses import (has_staff_access_to_course,
|
||||
has_staff_access_to_location)
|
||||
from requests import HttpBasicAuth
|
||||
|
||||
log = logging.getLogger("mitx.courseware")
|
||||
|
||||
|
||||
if settings.XQUEUE_INTERFACE['basic_auth'] is not None:
|
||||
requests_auth = HttpBasicAuth(*settings.XQUEUE_INTERFACE['basic_auth'])
|
||||
else:
|
||||
requests_auth = None
|
||||
|
||||
xqueue_interface = XQueueInterface(
|
||||
settings.XQUEUE_INTERFACE['url'],
|
||||
settings.XQUEUE_INTERFACE['django_auth'],
|
||||
settings.XQUEUE_INTERFACE['basic_auth'],
|
||||
requests_auth,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user