Skip to content

Commit

Permalink
fix: Pass AWS credentials correctly (#168)
Browse files Browse the repository at this point in the history
The access key ID and secret key had gotten reversed some years ago.
  • Loading branch information
ArturGaspar authored Dec 15, 2023
1 parent 03e94a1 commit 89ca1ea
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 89ca1ea

Please sign in to comment.