supabase-community / storage-py

Home Page:https://supabase-community.github.io/storage-py/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Invalid isoformat string when requesting a Storage bucket

betterthanever2 opened this issue · comments

I'm trying to connect to my Storage instance. When trying to access a bucket via Storage.get_bucket("bucket_name") I get a ValueError reporting wrong isoformat.
Full traceback:

  File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\Users\USER\AppData\Local\pypoetry\Cache\virtualenvs\wapaganda-mxnB5a1C-py3.10\lib\site-packages\storage3\_sync\bucket.py", line 52, in get_bucket
    return SyncBucket(**json, _client=self._client)
  File "<string>", line 10, in __init__
  File "C:\Users\USER\AppData\Local\pypoetry\Cache\virtualenvs\wapaganda-mxnB5a1C-py3.10\lib\site-packages\storage3\types.py", line 23, in __post_init__
    self.created_at = datetime.fromisoformat(self.created_at)  # type: ignore
ValueError: Invalid isoformat string: '2022-07-01T06:54:06.99359+00:00'

Addition: _.list_buckets() command produces a similar result.

Steps to reproduce the behavior:

  1. Create connection in the Python console
  2. Create Storage object via connection.Storage()
  3. Request bucket info from the server via Storage.get_bucket("bucket_name")
  4. See error

Expected behavior
I expect the error not to happen.

  • OS: Win10
  • Supabase lib version 0.7.1

Same error to me.
Just checked the storage repo and seems fixxed two monts ago.
The problem was that line: https://github.com/supabase-community/storage-py/blob/main/storage3/types.py#L24 previusly with datetime.fromisoformat.

I don't know why the version 0.71 still bugged and inner sources are old

Hey, apologies, finally managed to find a slot and am just seeing this.

Can I check if this is still an issue? Going to transfer to the storage3 repo for tracking

commented

This should be fixed now that we use dateutil.parser.isoparse instead of the stdlib function. If the error still occurs please re-open.