Skip to content

QR code recognition API proxy service that provides a RESTful API to proxy the Caoliao QR code recognition service. Supports image file upload and QR code content decoding, with automatic handling of API requests and response transformation.

Notifications You must be signed in to change notification settings

bobotechnology/cli-im-qrcode-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

QR Code Recognition API Proxy

A FastAPI-based proxy service for Caoliao QR code recognition API.

Features

  • Proxy service for Caoliao QR code recognition
  • Supports image file upload and QR code content decoding
  • Automatic API request handling and response transformation

API Specification

POST /decode_qrcode/

Parameters:

  • file: Image file in multipart/form-data format

Success Response:

{
    "content": "decoded QR code content"
}

Error Responses:

  • 400: Upload/Decode failure
  • 502: Third-party API returned invalid data

Example Request

curl -X POST -F "file=@qrcode.jpg" http://localhost:8000/decode_qrcode/

Error Handling

  • 400 Bad Request: Upload or decode failure
  • 502 Bad Gateway: Third-party API returned invalid data

How to Run

  1. Install dependencies:
pip install fastapi uvicorn aiohttp python-multipart
  1. Run the service:
python app.py

The service will be available at http://localhost:8000

Testing

Test Environment Setup

pip install pytest requests pillow qrcode[pil]

Running Tests

  1. First start the service:
python app.py
  1. In a new terminal, run API tests:
python -m unittest test.test

Expected Results

  • Valid QR code: Returns 200 status with content field
  • Invalid file: Returns 400 status with error field

Author

bobo

Version

v1.1

About

QR code recognition API proxy service that provides a RESTful API to proxy the Caoliao QR code recognition service. Supports image file upload and QR code content decoding, with automatic handling of API requests and response transformation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages