Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass AWS credentials correctly #168

Merged
merged 3 commits into from Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.rst
@@ -0,0 +1,23 @@
Change Log
##########

..
All enhancements and patches to openedx-django-pyfs will be documented
in this file. It adheres to the structure of https://keepachangelog.com/ ,
but in reStructuredText instead of Markdown (for ease of incorporation into
Sphinx documentation and the PyPI description).

This project adheres to Semantic Versioning (https://semver.org/).

.. There should always be an "Unreleased" section for changes pending release.

Unreleased
**********

3.4.1
*****

Fixed
=====

* fix: pass AWS credentials correctly (#168)
2 changes: 1 addition & 1 deletion djpyfs/__init__.py
@@ -1,3 +1,3 @@
# pylint: disable=django-not-configured
"""init file"""
__version__ = '3.4.0'
__version__ = '3.4.1'
2 changes: 1 addition & 1 deletion djpyfs/djpyfs.py
Expand Up @@ -132,7 +132,7 @@ def get_s3fs(namespace):
if 'prefix' in DJFS_SETTINGS:
fullpath = os.path.join(DJFS_SETTINGS['prefix'], fullpath)

s3fs = S3FS(DJFS_SETTINGS['bucket'], fullpath, aws_secret_access_key=key_id, aws_access_key_id=key_secret)
s3fs = S3FS(DJFS_SETTINGS['bucket'], fullpath, aws_access_key_id=key_id, aws_secret_access_key=key_secret)

def get_s3_url(self, filename, timeout=60): # pylint: disable=unused-argument
"""
Expand Down
5 changes: 5 additions & 0 deletions djpyfs/tests.py
Expand Up @@ -320,6 +320,11 @@ def _setUpS3(self):
self.conn = boto3.resource('s3')
self.conn.create_bucket(Bucket=djpyfs.DJFS_SETTINGS['bucket'])

def test_aws_credentials(self):
fs = djpyfs.get_filesystem(self.namespace)
self.assertEqual(fs.aws_access_key_id, 'foo')
self.assertEqual(fs.aws_secret_access_key, 'bar')

# This test is only relevant for S3. Generate some fake errors to make
# sure we cover the retry code.
def test_get_url_retry(self):
Expand Down