Commit 1be3057d by kimth

xqueue interface in LMS not responsible for S3 upload

parent f023dc6e
...@@ -6,41 +6,11 @@ import json ...@@ -6,41 +6,11 @@ import json
import requests import requests
import time import time
from boto.s3.connection import S3Connection
from boto.s3.key import Key
# TODO: Collection of parameters to be hooked into rest of edX system # TODO: Collection of parameters to be hooked into rest of edX system
XQUEUE_LMS_AUTH = { 'username': 'LMS', XQUEUE_LMS_AUTH = { 'username': 'LMS',
'password': 'PaloAltoCA' } 'password': 'PaloAltoCA' }
XQUEUE_SUBMIT_URL = 'http://xqueue.edx.org' XQUEUE_SUBMIT_URL = 'http://xqueue.edx.org'
AWS_ACCESS_KEY = 'AKIAIYY272VA3C5R4DSQ'
AWS_SECRET_KEY = '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'
AWS_BUCKET_NAME = 'XQUEUE'
def upload_files_to_s3(submission_file):
'''
Upload student file submissions to S3.
Returns the S3 key for accessing the file
'''
print type(submission_file)
print dir(submission_file)
print submission_file
conn = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KEY)
bucket_name = AWS_ACCESS_KEY + AWS_BUCKET_NAME
bucket = conn.create_bucket(bucket_name.lower()) # Bucket names must be lowercase...
k = Key(bucket)
k.key = submission_file.name
k.set_contents_from_string(submission_file.read)
s3_identifier = k.generate_url(60)
print s3_identifier
return s3_identifier
def make_hashkey(seed=None): def make_hashkey(seed=None):
''' '''
Generate a string key by hashing Generate a string key by hashing
...@@ -51,6 +21,7 @@ def make_hashkey(seed=None): ...@@ -51,6 +21,7 @@ def make_hashkey(seed=None):
h.update(str(time.time())) h.update(str(time.time()))
return h.hexdigest() return h.hexdigest()
def make_xheader(lms_callback_url, lms_key, queue_name): def make_xheader(lms_callback_url, lms_key, queue_name):
''' '''
Generate header for delivery and reply of queue request. Generate header for delivery and reply of queue request.
......
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