Skip to content

nditc/nditc_conv_api

Repository files navigation

NDTC CONV API

Made in python using FastApi, Openpyxl, Weasyprint

Use app.py for Flask

Installation

virtualenv venv
venv/Scripts/activate
pip install -r requirements.txt

For weasyprint setup check docs here

Post installation

  • Create keys.py file and put api keys in a set named API_KEYS
  • Generate api keys using key_gen.py and put it in API_KEYS, like...
API_KEYS = {"something...."}

Run the api

  • Dev
fastapi dev main.py
  • Prod
uvicorn main:app --host 0.0.0.0 --port 80

Usage

  • Converts JSON to XLSX
/json-to-xlsx/{method_id}?api_key=...
  • Converts XLSX to JSON
/xlsx-to-json?api_key=....
  • Converts HTML to PDF
/html-to-pdf/{method_id}?api_key=...

Test cases are written in tests.py

method_id = 1 for getting the data stream
method_id = 2 for getting the url of the file
files are saved on the disk for 60sec

Task List

  • JSON to XLSX
  • XLSX to JSON
  • Test for JSON <-> XLSX
  • HTML to PDF
  • Test for HTML -> PDF
  • API key auth
  • Add logger

About

Small python api to convert json, xlsx, html, pdf files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published