From 67e77cdb88ac086dff1640e91ef3297196634059 Mon Sep 17 00:00:00 2001
From: sungmin <smoh2044@gmail.com>
Date: Thu, 29 Oct 2020 13:28:16 -0700
Subject: [PATCH] Check self.access_token after set.

Afaik, aws cli supports access token to be set in the credential file.
So I have a local cron job that updates access token in `.aws/credentials` and `.s3cfg` file.
By this change, s3cmd won't request a token if it is set in `.s3cfg` or `.aws/credentails` though it is not given by command line
---
 S3/Config.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/S3/Config.py b/S3/Config.py
index adbab442d..b07074670 100644
--- a/S3/Config.py
+++ b/S3/Config.py
@@ -273,7 +273,8 @@ def __init__(self, configfile = None, access_key=None, secret_key=None, access_t
                 self.secret_key = secret_key
             if access_token:
                 self.access_token = access_token
-                # Do not refresh the IAM role when an access token is provided.
+            # Do not refresh the IAM role when an access token is provided.
+            if self.access_token:
                 self._access_token_refresh = False
 
             if len(self.access_key)==0: