Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 2020-02-03 Version 0.1.4
* Optimize the way to obtain the credentials.ini file.

### 2020-01-28 Version 0.1.3
* Support async refresh credentials.

Expand Down
2 changes: 1 addition & 1 deletion alibabacloud_credentials/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.3"
__version__ = "0.1.4"
5 changes: 4 additions & 1 deletion alibabacloud_credentials/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import time
import configparser
import calendar
import os

from Tea.core import TeaCore
from Tea.request import TeaRequest
Expand Down Expand Up @@ -354,7 +355,9 @@ def __init__(self, path=None):
def parse_ini(self):
file_path = self.file_path if self.file_path else au.environment_credentials_file
if file_path is None:
file_path = ac.DEFAULT_CREDENTIALS_FILE_PATH
if not ac.HOME:
return
file_path = os.path.join(ac.HOME, "/.alibabacloud/credentials.ini")
if len(file_path) == 0:
raise CredentialException("The specified credentials file is empty")

Expand Down
6 changes: 1 addition & 5 deletions alibabacloud_credentials/utils/auth_constant.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import os

try:
DEFAULT_CREDENTIALS_FILE_PATH = os.environ['HOME'] + "/.alibabacloud/credentials.ini"
except KeyError:
DEFAULT_CREDENTIALS_FILE_PATH = os.environ['HOMEPATH'] + "/.alibabacloud/credentials.ini"

HOME = os.getenv('HOME') if os.getenv('HOME') else os.getenv('HOMEPATH')
INI_ACCESS_KEY_ID = "access_key_id"
INI_ACCESS_KEY_IDSECRET = "access_key_secret"
INI_TYPE = "type"
Expand Down