ENCOA-276, ENCOA-277
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
import aiofiles
|
||||
@@ -40,6 +41,7 @@ class FirebaseStorage(IFileStorage):
|
||||
async with aiofiles.open(source_file_name, 'rb') as file:
|
||||
file_bytes = await file.read()
|
||||
|
||||
created = datetime.now().isoformat()
|
||||
response = await self._httpx_client.post(
|
||||
upload_url,
|
||||
headers={
|
||||
@@ -47,7 +49,7 @@ class FirebaseStorage(IFileStorage):
|
||||
"X-Goog-Upload-Protocol": "multipart"
|
||||
},
|
||||
files={
|
||||
'metadata': (None, '{"metadata":{"test":"testMetadata"}}', 'application/json'),
|
||||
'metadata': (None, '{"metadata":{"created":"'+ created + '"}}', 'application/json'),
|
||||
'file': file_bytes
|
||||
}
|
||||
)
|
||||
@@ -70,7 +72,7 @@ class FirebaseStorage(IFileStorage):
|
||||
response = await self._httpx_client.post(
|
||||
acl_url,
|
||||
headers={
|
||||
'Authorization': f'Bearer {self._token}',
|
||||
'Authorization': f'Firebase {self._token}',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
json=acl
|
||||
|
||||
Reference in New Issue
Block a user