msc: upload_pictures() docs

rrr-marble 5 years ago
parent ea9c05dcc0
commit 5840126b6d

@ -11,5 +11,5 @@ DEST_SHRUNK = "image/"
DEST_ORIGINAL = "original/"
# upload interface credentials
CRED_USERNAME="changeme"
CRED_PASSWORD="CHANGEME"
CRED_USERNAME = "changeme"
CRED_PASSWORD = "CHANGEME"

@ -162,7 +162,7 @@ async def rate_picture(cookie: str, picture_id: int, mark: int):
@app.post(
"/upload_pictures/",
"/upload_pictures",
responses={
202: {"description": "Archive accepted into processing"},
401: {"description": "Authentication is required to access this resource"},
@ -174,10 +174,12 @@ async def upload_pictures(
credentials: HTTPBasicCredentials = Depends(security),
file: UploadFile = File(...),
):
"""Интерфейс для загрузки фотографий"""
"""Условно кладём в браузер zip с фотографиями и он их потихоньку ест.
Доступ к этому интерфейсу, наверное, лучше ограничить паролем или как-нибудь ещё.
Пока исходим из предположения, что только я буду загружать фотографии.
"""Photo upload endpoint"""
"""
Accepts photo in zip archives with any internal directory structure
Valid uploads yield 202 status message and process photos in the background
Non-zip archives yeild 415 error
Upload is restricted by basic HTTP login, configurable in config.py
"""
# check authenticity
correct_username = compare_digest(credentials.username, CRED_USERNAME)
@ -204,8 +206,8 @@ def unpack_pictures_zip(file: UploadFile, time):
"""
Unpack and process zip archived photo
Extract pictures in the DATA_LOCATION/processing
#TODO: and feed them to util/import_photos.py
#TODO: Walk the nested DATA_LOCATION/processing ourselves
and feed them to util/import_photos.py
Walk the nested DATA_LOCATION/processing ourselves
Uses: DB_LOCATION, DATA_LOCATION
"""
# we only call this function sporadically, so import here

Loading…
Cancel
Save