Add basic authentication support for requests made to the xqueue server
This commit is contained in:
@@ -94,8 +94,9 @@ JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee'
|
||||
#################### CAPA External Code Evaluation #############################
|
||||
XQUEUE_INTERFACE = {
|
||||
'url': 'http://localhost:8888',
|
||||
'auth': {'username': 'local',
|
||||
'password': 'local'}
|
||||
'django_auth': {'username': 'local',
|
||||
'password': 'local'},
|
||||
'basic_auth': None,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,10 +60,10 @@ class XQueueInterface:
|
||||
Interface to the external grading system
|
||||
'''
|
||||
|
||||
def __init__(self, url, auth):
|
||||
def __init__(self, url, django_auth, basic_auth=None):
|
||||
self.url = url
|
||||
self.auth = auth
|
||||
self.session = requests.session()
|
||||
self.auth = django_auth
|
||||
self.session = requests.session(auth=basic_auth)
|
||||
|
||||
def send_to_queue(self, header, body, file_to_upload=None):
|
||||
'''
|
||||
|
||||
@@ -25,7 +25,8 @@ log = logging.getLogger("mitx.courseware")
|
||||
|
||||
xqueue_interface = XQueueInterface(
|
||||
settings.XQUEUE_INTERFACE['url'],
|
||||
settings.XQUEUE_INTERFACE['auth']
|
||||
settings.XQUEUE_INTERFACE['django_auth'],
|
||||
settings.XQUEUE_INTERFACE['basic_auth'],
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -55,10 +55,11 @@ CACHES = {
|
||||
|
||||
XQUEUE_INTERFACE = {
|
||||
"url": "http://xqueue.sandbox.edx.org",
|
||||
"auth": {
|
||||
"django_auth": {
|
||||
"username": "lms",
|
||||
"password": "***REMOVED***"
|
||||
}
|
||||
},
|
||||
"basic_auth": ('anant', 'agarwal'),
|
||||
}
|
||||
|
||||
# Make the keyedcache startup warnings go away
|
||||
|
||||
@@ -52,10 +52,11 @@ GITHUB_REPO_ROOT = ENV_ROOT / "data"
|
||||
|
||||
XQUEUE_INTERFACE = {
|
||||
"url": "http://xqueue.sandbox.edx.org",
|
||||
"auth": {
|
||||
"django_auth": {
|
||||
"username": "lms",
|
||||
"password": "***REMOVED***"
|
||||
}
|
||||
},
|
||||
"basic_auth": ('anant', 'agarwal'),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user