Code Monkey home page Code Monkey logo

barcode-service's Introduction

Barcode Service

Simple and small python service designed to generate and read Barcode, QRCode, Aztec Code, DataMatrix.

Demo

https://barcode.adrox.xyz/api/v1/
https://barcode.adrox.xyz/api/v1/docs

Requirements and dependencies

The website was written using Python 3.8 and FastAPI.
The dependencies are listed in the pyproject.toml file.

Installation

By default, the application is served on port 8000.

Local

To run the application locally, install the dependencies using poetry

poetry install

file and then execute the command

uvicorn app.main:app --reload

in the application's root directory.

Docker

Run the container from the available registry.

docker run -p 8000:8000 adrixop95/barcodegenerator:latest

If you want, you can maintain the consistency of the generated codes by mounting the following folders:

  • /app/aztec
  • /app/barcode
  • /app/qrcode
  • /app/datamatrix

The service does not have any environment variables.

docker-compose example

To run the application on localhost from docker-compose, go to the deployment/docker-compose folder and execute the command:

Windows:

$env:URL="localhost"; docker-compose -f docker-compose.yml up

Linux, macOS:

URL="localhost" docker-compose -f .\docker-compose.yml up

Traefik automatically manages the SSL certificate generating the let's encrypt certificate. The certificate is generated for [email protected], please change if necessary.

After launch, it will be available at https://localhost/api/v1/

Kubernetes example

Running the application using kubernetes requires having installed helm and installing a traefik with it.
Installation of the traefik can be performed using the following commands:

$ helm repo add traefik https://containous.github.io/traefik-helm-chart
$ helm repo update
$ helm install traefik traefik/traefik

Then go to the deployment/kubernetes folder and execute the following commands:

$ helm upgrade traefik traefik/traefik --values 000-values.yaml
$ kubectl apply -f 001-deployment.yaml

Traefik automatically manages the SSL certificate generating the let's encrypt certificate. The certificate is generated for [email protected], please change if necessary.

In order for the application to be launched on an address other than localhost, localhost addresses should be changed in the 001-deployment.yaml file to the target address of your choice.

Without changing the configuration and parameters, the application will be available at: https://localhost.

Requests

Swagger is available at /docs path.

List of available requests:

barcode

Request type: post
Request path: /api/v1/barcode/generate
Data:

barcode_type: str [values: EAN8,EAN13,EAN14,UPCA,JAN,ISBN10,ISBN13,ISSN,Code39,Code128,PZN]
barcode_message: str [Just a message]

qrcode

Request type: post
Request path: /api/v1/qrcode/generate
Data:

qrcode_scale: int [Image scale between 1 to int constraint]
qrcode_message: str [Just a message]
qrcode_error_correct: Optional[str] = None [L (7% compression), M (15% compression), Q (25% compression), H (30% compression) or just remove this parameter from request]

Request type: post
Request path: /api/v1/qrcode/decrypt
Data:

file: string($binary) [Just a file]

aztec

Request type: post
Request path: /api/v1/aztec/generate
Data:

aztec_code_scale: int [Image scale between 1 to int constraint]
aztec_code_message: str [Just a message]

datamatrix

Request type: post
Request path: /api/v1/datamatrix/generate
Data:

data_matrix_message: str [Just a message]

Request type: post
Request path: /api/v1/datamatrix/decrypt
Data:

file: string($binary) [Just a file]

License

The application is available under the GNU GENERAL PUBLIC LICENSE.

barcode-service's People

Contributors

adrixop95 avatar gostekk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.