Skip to content

Commit

Permalink
cleanup whitespace and fix license header (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and kannappanr committed Jan 23, 2020
1 parent 68432fd commit 7d8a225
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
10 changes: 5 additions & 5 deletions examples/aws_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
# The default AWS metadata service can be found at:
# -> 169.254.169.254/latest/meta-data/iam/security-credentials
#
# If you wish to retieve credentials from a different place you can provide
# If you wish to retrieve credentials from a different place you can provide
# the 'endpoint' paramater to the IamEc2MetaData credentials object

from minio.credentials import IamEc2MetaData

# Initialize Minio with IamEc2MetaData default credentials object
client = Minio('s3.amazonaws.com',
client = Minio('s3.amazonaws.com',
credentials=IamEc2MetaData())

# Initialize Minio with IamEc2MetaData custom
# Initialize Minio with IamEc2MetaData custom

client = Minio('s3.amazonaws.com',
credentials=IamEc2MetaData(endpoint='custom.endpoint'))
client = Minio('s3.amazonaws.com',
credentials=IamEc2MetaData(endpoint='custom.endpoint'))
4 changes: 2 additions & 2 deletions examples/chain_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

from minio.credentials import Chain, EnvAWS, EnvMinio, IamEc2MetaData

client = Minio('s3.amazonaws.com',
client = Minio('s3.amazonaws.com',
credentials=Chain(
providers=[
IamEc2MetaData(),
EnvAWS(),
EnvMinio()
]
))
))
2 changes: 1 addition & 1 deletion minio/credentials/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, forceRefresh=True, provider=None):
self._creds = None
self._forceRefresh = forceRefresh
self._provider = provider

def get(self):
if self.is_expired():
try:
Expand Down
2 changes: 1 addition & 1 deletion minio/credentials/env_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def retrieve(self):
access_key = os.environ.get('AWS_ACCESS_KEY_ID')
if access_key == "":
access_key = os.environ.get('AWS_ACCESS_KEY')

secret = os.environ.get('AWS_SECRET_ACCESS_KEY')
if secret == "":
secret = os.environ.get('AWS_SECRET_KEY')
Expand Down
2 changes: 1 addition & 1 deletion minio/credentials/env_minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def retrieve(self):
secret = os.environ.get('MINIO_SECRET_KEY')

self._retrieved = True

return Value(
access_key=id,
secret_key=secret
Expand Down
4 changes: 2 additions & 2 deletions minio/credentials/file_aws_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def retrieve(self):
if self._filename == "" or self._filename is None:
home_dir = os.environ.get('HOME')
self._filename = os.path.join(home_dir, '.aws', 'credentials')

if self._profile == "" or self._profile is None:
self._profile = os.environ.get('AWS_PROFILE')
if self._profile == "" or self._profile is None:
Expand All @@ -49,7 +49,7 @@ def retrieve(self):
session_token = ini_profile.get(self._profile, 'aws_session_token')
except:
pass

if access_key == '' or secret == '':
return Value()

Expand Down
4 changes: 2 additions & 2 deletions minio/credentials/file_minio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def retrieve(self):
self._alias = os.environ.get('MINIO_ALIAS')
if self._alias == "" or self._alias is None:
self._alias = "s3"

self._retrieved = False

config = open(self._filename, 'r')
doc = json.load(config)
creds = doc['hosts'][self._alias]

access_key = creds['accessKey']
secret_key = creds['secretKey']

Expand Down
5 changes: 3 additions & 2 deletions minio/signer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage, (C) 2015 MinIO, Inc.
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015-2020 MinIO, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -146,7 +147,7 @@ def presign_v4(method, url, credentials,
content_hash_hex)
string_to_sign = generate_string_to_sign(request_date, region,
canonical_request)
signing_key = generate_signing_key(request_date, region,
signing_key = generate_signing_key(request_date, region,
credentials.get().secret_key)
signature = hmac.new(signing_key, string_to_sign.encode('utf-8'),
hashlib.sha256).hexdigest()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/minio_mocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015,2016 MinIO, Inc.
# (C) 2015-2020 MinIO, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,7 +57,7 @@ def stream(self, chunk_size=1, decode_unicode=False):
# dummy release connection call.
def release_conn(self):
return

def __getitem__(self, key):
if key == "status":
return self.status
Expand Down

0 comments on commit 7d8a225

Please sign in to comment.