Skip to content

thiagonmiziara/nlw-expert-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tag Creator

This project provides functionality to create barcode tags for products.

Description

The Tag Creator project allows users to generate barcode images for products. It includes endpoints to create tags and handles the generation of barcode images using the Code128 format.

Features

  • Create Tag: Endpoint /create_tag to create a barcode tag for a product.
  • Barcode Generation: Barcode images are generated using the Code128 format.

Installation

  1. Clone the repository:

    git clone <repository_url>
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up the environment:

    # Assuming you're using virtualenv
    source <virtualenv_name>/bin/activate
  4. Run the application:

    python app.py

Usage

  1. Send a POST request to /create_tag with the product details in the request body.
  2. The application will generate a barcode image for the product and return the path to the image.

Endpoints

  • Create Tag:
    • URL: /create_tag
    • Method: POST
    • Request Body: JSON with product details.
    • Response: JSON with the path to the generated barcode image.

Sample Request

{
  "product_code": "123456789"
}

Sample Response

{
  "data": {
    "type": "Tag Image",
    "count": 1,
    "path": "/path/to/barcode.png"
  }
}

Error Handling

  • HTTP 422 Unprocessable Entity: If there are validation errors or invalid requests, the API returns an error response with details.
  • HTTP 500 Server Error: For unexpected errors, the API returns a generic server error response.

Technologies Used

  • Python
  • Flask
  • Barcode (Python library)

Contributors

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages