3
3
from collections .abc import Awaitable
4
4
from dataclasses import dataclass
5
5
from datetime import datetime
6
- from typing import Any , Literal , Optional , Type , Union
6
+ from typing import Any , Dict , List , Optional , Type , Union
7
7
8
8
from httpx import AsyncClient , Client , HTTPError
9
9
10
10
__all__ = ["Bucket" , "StorageBucketAPI" ]
11
11
12
- _RequestMethod = Literal [ "GET" , "POST" , "PUT" , "DELETE" , "PATCH" ]
12
+ _RequestMethod = str
13
13
14
14
15
15
class StorageException (Exception ):
@@ -33,10 +33,10 @@ def __post_init__(self) -> None:
33
33
34
34
35
35
ResponseType = Union [
36
- dict [
36
+ Dict [
37
37
str , str
38
38
], # response from an endpoint without a custom response_class, example: create_bucket
39
- list [
39
+ List [
40
40
Bucket
41
41
], # response from an endpoint which returns a list of objects, example: list_buckets
42
42
Bucket , # response from an endpoint which returns a single object, example: get_bucket
@@ -80,7 +80,7 @@ def _sync_request(
80
80
response_class : Optional [Type ] = None ,
81
81
) -> ResponseType :
82
82
if isinstance (self ._client , AsyncClient ): # only to appease the type checker
83
- return
83
+ return None
84
84
85
85
response = self ._client .request (method , url , json = json )
86
86
try :
0 commit comments