A simple API for generate a qr code and bar code
clone this repository and install python 3.8 or highter, and install dependencies
pip install Pillow python-barcode qrcode fastapi requests "uvicorn[standard]"
run this command to run the project:
uvicorn app.main:app --host 0.0.0.0 --port 8080
First install docker
docker compose up -d
you can go to on http://localhost:8080/docs for test
GET /qr-code?data=(encoded data)
You can generate the qr code directly in an html img like
<img src="http://localhost:8080/qr-code?data=Some%20data" alt=""/>
or for more customize qr code you can use
POST /qr-code/generate
Parameter | Type | Description |
---|---|---|
data |
string |
Required. Your data |
color |
string |
Optional. Color of your qr code [hex] (default: #000000) |
bg_color |
string |
Optional. Color of the background [hex] (default: #ffffff) |
style_points |
string |
Optional. style of the points [square/gapped_square/circle/rounded/vertical_bar/horizontal_bar] (default:square) |
image_url |
string |
Optional. add an image in your qr code (default:empty) |
POST /bar-code/generate
Parameter | Type | Description |
---|---|---|
data |
string |
Required. Your data |
Fork this repository and create a pull request with a description