Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
843f8ae9
Commit
843f8ae9
authored
Aug 02, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic uploads to S3
parent
3b3482b3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
lms/djangoapps/courseware/xqueue_interface.py
+28
-2
No files found.
lms/djangoapps/courseware/xqueue_interface.py
View file @
843f8ae9
...
...
@@ -4,13 +4,39 @@
import
json
import
requests
from
boto.s3.connection
import
S3Connection
from
boto.s3.key
import
Key
# TODO: Collection of parameters to be hooked into rest of edX system
XQUEUE_LMS_AUTH
=
(
'LMS'
,
'PaloAltoCA'
)
# (username, password)
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
):
print
' THK: xqueue_interface.upload_files_to_s3'
return
''
'''
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_xheader
(
lms_callback_url
,
lms_key
,
queue_name
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment