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

issue #39: pass use_ssl, verify arguments to boto3 client constructor #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions fs_s3fs/_s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ class S3FS(FS):
the key from standard configuration files.
:param str aws_secret_access_key: The secret key, or ``None`` to
read the key from standard configuration files.
:param bool use_ssl: Whether or not to use SSL. The default is ``True``.
:param bool or str verify: Whether or not to verify SSL certificates. By
default SSL certificates are verified. Set to ``False`` to disable
verification of SSL certificates. To use a different CA cert bundle
than the one used by botocore, set this parameter to a string that is
the path to a CA cert bundle. The default is ``None``, which inherits
the default behavior of botocore.
:param str endpoint_url: Alternative endpoint url (``None`` to use
default).
:param str aws_session_token:
Expand Down Expand Up @@ -275,6 +282,8 @@ def __init__(self,
aws_access_key_id=None,
aws_secret_access_key=None,
aws_session_token=None,
use_ssl=True,
verify=None,
endpoint_url=None,
region=None,
delimiter='/',
Expand All @@ -295,6 +304,8 @@ def __init__(self,
self.aws_access_key_id = aws_access_key_id
self.aws_secret_access_key = aws_secret_access_key
self.aws_session_token = aws_session_token
self.use_ssl = use_ssl
self.verify = verify
self.endpoint_url = endpoint_url
self.region = region
self.delimiter = delimiter
Expand Down Expand Up @@ -381,6 +392,8 @@ def s3(self):
aws_access_key_id=self.aws_access_key_id,
aws_secret_access_key=self.aws_secret_access_key,
aws_session_token=self.aws_session_token,
use_ssl=self.use_ssl,
verify=self.verify,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use_ssl and verify arguments need to be applied below as well, starting on line 410 (in the "client" method).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! thanks for catching my silly oversight. fixed

endpoint_url=self.endpoint_url
)
return self._tlocal.s3
Expand All @@ -394,6 +407,8 @@ def client(self):
aws_access_key_id=self.aws_access_key_id,
aws_secret_access_key=self.aws_secret_access_key,
aws_session_token=self.aws_session_token,
use_ssl=self.use_ssl,
verify=self.verify,
endpoint_url=self.endpoint_url
)
return self._tlocal.client
Expand Down
10 changes: 10 additions & 0 deletions fs_s3fs/opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ def open_fs(self, fs_url, parse_result, writeable, create, cwd):
raise OpenerError(
"invalid bucket name in '{}'".format(fs_url)
)
use_ssl = (
parse_result.params['use_ssl'] == '1'
if 'use_ssl' in parse_result.params
else True
)
verify = parse_result.params.get('verify', None)
if verify == '':
verify = False
strict = (
parse_result.params['strict'] == '1'
if 'strict' in parse_result.params
Expand All @@ -32,6 +40,8 @@ def open_fs(self, fs_url, parse_result, writeable, create, cwd):
dir_path=dir_path or '/',
aws_access_key_id=parse_result.username or None,
aws_secret_access_key=parse_result.password or None,
use_ssl=use_ssl,
verify=verify,
endpoint_url=parse_result.params.get('endpoint_url', None),
acl=parse_result.params.get('acl', None),
cache_control=parse_result.params.get('cache_control', None),
Expand Down