This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from http.client import HTTPConnection # py3 | |
log = logging.getLogger('urllib3') | |
log.setLevel(logging.DEBUG) | |
# logging from urllib3 to console | |
ch = logging.StreamHandler() | |
ch.setLevel(logging.DEBUG) | |
log.addHandler(ch) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROFILE=profile | |
MFA_SERIAL=xxx | |
USER=xxx | |
RESULT=$(aws sts get-session-token --serial-number arn:aws:iam::${MFA_SERIAL}:mfa/${USER} --token-code $1 --profile ${PROFILE}) | |
ACCESS_KEY_ID="$(echo $RESULT | jq '.Credentials.AccessKeyId' -r)" | |
SECRET_KEY=$(echo $RESULT | jq '.Credentials.SecretAccessKey' -r) | |
TOKEN=$(echo $RESULT | jq '.Credentials.SessionToken' -r) |