Commit 8ce12b10 by Calen Pennington

Pass HttpBasicAuth object to requests, rather than a list, which it didn't understand

parent c4bed2c1
......@@ -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,
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment