This commit is contained in:
parent
aa49f26689
commit
7ae76562fa
20
main.py
20
main.py
|
@ -2,12 +2,14 @@ import logging
|
|||
import os
|
||||
import tempfile
|
||||
import uuid
|
||||
import aioboto3
|
||||
import aiobotocore.session
|
||||
from starlette.applications import Starlette
|
||||
from starlette.responses import JSONResponse
|
||||
from starlette.routing import Route
|
||||
from starlette.requests import Request
|
||||
from auth import login_required
|
||||
from logger import root_logger as logger
|
||||
|
||||
|
||||
from settings import (
|
||||
PORT,
|
||||
|
@ -18,14 +20,20 @@ from settings import (
|
|||
STORJ_END_POINT,
|
||||
)
|
||||
|
||||
|
||||
async def create_s3_client():
|
||||
return aioboto3.Session().create_client(
|
||||
"s3",
|
||||
aws_access_key_id=STORJ_ACCESS_KEY,
|
||||
aws_secret_access_key=STORJ_SECRET_KEY,
|
||||
endpoint_url=STORJ_END_POINT,
|
||||
return (
|
||||
aiobotocore.session.get_session()
|
||||
.create_client(
|
||||
"s3",
|
||||
aws_access_key_id=STORJ_ACCESS_KEY,
|
||||
aws_secret_access_key=STORJ_SECRET_KEY,
|
||||
endpoint_url=STORJ_END_POINT,
|
||||
)
|
||||
.meta.client
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
async def upload_handler(request: Request):
|
||||
logging.debug("Received upload request")
|
||||
|
|
Loading…
Reference in New Issue
Block a user