aiohttp-s3-client icon indicating copy to clipboard operation
aiohttp-s3-client copied to clipboard

A couple issues with MetadataCredentials

Open lopatin opened this issue 1 year ago • 1 comments

Hello, first of all thanks for the great library.

I ran into two issues with MetadataCredentials when running on AWS Glue 4.0 with Python 3.10:

  1. Incorrect pattern for strptime.
Failed to update credentials
Traceback (most recent call last):
  File "/home/spark/.local/lib/python3.10/site-packages/aiohttp_s3_client/credentials.py", line 261, in _refresher
    credentials, expires_at = await self._fetch_credentials()
  File "/home/spark/.local/lib/python3.10/site-packages/aiohttp_s3_client/credentials.py", line 309, in _fetch_credentials
    datetime.datetime.strptime(
  File "/usr/local/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.10/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2024-08-14T09:39:55.439Z' does not match format '%Y-%m-%dT%H:%M:%SZ'
  1. Infinitely waits when calling await credentials.stop(). It seems to wait on the _refresher task to finish, which is a while True loop with no breaks.

I monkey patched both issues on my end to get unblocked, but just wanted to point this out. I'm happy to contribute a fix to the project if the maintainers agree it's something in need.

Thanks, Alex

lopatin avatar Aug 14 '24 17:08 lopatin

Feel free to contribute

mosquito avatar Aug 14 '24 22:08 mosquito