# calibre-api **Repository Path**: yzhh/calibre-api ## Basic Information - **Project Name**: calibre-api - **Description**: fastapi ebook convert api base on calibre command line - **Primary Language**: Python - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-07-22 - **Last Updated**: 2022-11-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #### Introduce This is an e-book format conversion interface developed based on fastapi and dependent on calibre. ps: This is a fastapi project exercise. ps: This api is developed based on python 3.8, and other python versions have not been tested. #### Installation 1. In debian/ubuntu To use this api, you need to install the calibre software on your computer. ```commondLine sudo apt-get update sudo apt-get install -y calibre pip install -r requirement.txt uvicorn app.main:app --host 0.0.0.0 --port 8000 ``` 2. Use docker There have a dockerfile in this project , you can use that file to build a docker image. run mysql ```commondLine docker pull mysql docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql ``` run redis ```commondLine docker pull redis docker run -d -p 6379:6379 redis ``` runserver ```commondLine docker pull python:3.8 docker build -t fastapi-ebook-convert . docker run -i -t -d \ -e BACKEND_URL=redis://172.17.0.1:6379/0 \ -e BROKER_URL=redis://172.17.0.1:6379/1 \ -e DATABASE_URL=mysql://root:123456@172.17.0.1:3306 \ -e SECRET_KEY=abcd0123456789 \ -p 8000:8000 --name ebook-convert-test fastapi-ebook-convert ``` Environmental parameters | name | default | explanation | |:---:|:---:|:---:| | SECRET_KEY | | Don't use default secret key, use "openssl rand -hex 32" to create a new key. | | DATABASE_URL | sqlite:///.test.db | The default database is sqlite, and it is not recommended to use sqlite in production. You can use postgresql or mysql instead of sqlite. Like: "postgresql://user:password@postgressserver/db". | | EBOOK_CONVERT_USERNAME | admin | Default username. | | EBOOK_CONVERT_PASSWORD | admin | Default user password. | | DOCS_URL | None | Whether to use docs. If not filled in, it means not to use. | | REDOC_URL | None | Whether to use redoc. If not filled in, it means not to use. | | BACKEND_URL | | | | BROKER_URL | | | | | | | #### Instructions 1. fetch token /token 2. create a new task /create-task 3. upload file /upload-file/{task_id} 4. query result /query-result/{task_id} 5. download file /download-file/{task_id}