You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently implementing my own CredentialsProvider that provides RefreshableCredentials. I'm having issues with code that has been working, but recently broke. I have to wonder if either one of my dependencies got bumped (although I can't prove it) or because we just entered daylight savings.
Basically, I'm always hitting this condition:
Credentials were refreshed, but the refreshed credentials are still expired.
To create my meta-data, I'm using the same(?) code used in botocore:
from datetime import datetime, timedelta
from dateutil.tz import tzlocal
expiration = datetime.now(tzlocal()) + timedelta(minutes=5)
expiration.strftime('%Y-%m-%dT%H:%M:%SZ')
'2016-04-07T10:26:04Z'
This doesn't encode my local time zone information, as %Z is needed.
I can demonstrate this inconsistency using some of the internal boto funcs
from botocore.credentials import _local_now, _serialize_if_needed, _parse_if_needed
now = _local_now()
print now
serialized = _serialize_if_needed(now)
print serialized
deserialized = _parse_if_needed(serialized)
print deserialized
print now - deserialized
I can fix this issue on my end by encoding the timezone information in my format string '%Y-%m-%dT%H:%M:%S%Z', but I'm convinced botocore should do the same in its default time serialization code
TL;DR
It seems like your time_fetcher is using a timezone aware (tzlocal) datetime, but you're losing the timezone information upon serialization, defaulting to UTC. So in my case, it's comparing EST to UTC when determining expiration time.
The text was updated successfully, but these errors were encountered:
Hey boto folks -
I'm currently implementing my own CredentialsProvider that provides RefreshableCredentials. I'm having issues with code that has been working, but recently broke. I have to wonder if either one of my dependencies got bumped (although I can't prove it) or because we just entered daylight savings.
Basically, I'm always hitting this condition:
To create my meta-data, I'm using the same(?) code used in botocore:
This doesn't encode my local time zone information, as %Z is needed.
I can demonstrate this inconsistency using some of the internal boto funcs
I can fix this issue on my end by encoding the timezone information in my format string
'%Y-%m-%dT%H:%M:%S%Z'
, but I'm convinced botocore should do the same in its default time serialization codeTL;DR
It seems like your
time_fetcher
is using a timezone aware (tzlocal) datetime, but you're losing the timezone information upon serialization, defaulting to UTC. So in my case, it's comparing EST to UTC when determining expiration time.The text was updated successfully, but these errors were encountered: