msc: upload_pictures() docs

pull/5/head
rrr-marble 4 years ago
parent 4b0b6ab9cc
commit 3e35188739

@ -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"

@ -188,7 +188,7 @@ async def photo_points():
for point in points
]
@app.post(
"/upload_pictures/",
"/upload_pictures",
responses={
202: {"description": "Archive accepted into processing"},
401: {"description": "Authentication is required to access this resource"},
@ -200,10 +200,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)
@ -230,8 +232,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