photolib/photoapp/api.py

42 lines
1.2 KiB
Python

import os
import cherrypy
import logging
from datetime import datetime, timedelta
from photoapp.library import PhotoLibrary
from photoapp.types import Photo, PhotoSet, Tag, TagItem, PhotoStatus, User
from jinja2 import Environment, FileSystemLoader, select_autoescape
from sqlalchemy import desc
from sqlalchemy import func, and_, or_
from photoapp.common import pwhash
import math
from urllib.parse import urlparse
from photoapp.utils import mime2ext, auth, require_auth, photo_auth_filter, slugify
from photoapp.dbutils import db
class PhotosApi(object):
def __init__(self):
self.v1 = PhotosApiV1()
class PhotosApiV1(object):
def __init__(self):
# self.tpl.filters.update(mime2ext=mime2ext,
# basename=os.path.basename,
# ceil=math.ceil,
# statusstr=lambda x: str(x).split(".")[-1])
pass
@cherrypy.expose
def index(self):
yield f"<plaintext>hello, this is the api. my database is: {db()}\n"
@cherrypy.expose
def upload(self, files, meta):
pass
@cherrypy.expose
@cherrypy.tools.json_out()
def findbysha(self, sha):
pass