git clone https://github.com/FaizAlam/image_processor.git && cd image_processorpython3 -m venv myvenv- Windows:
.\myvenv\Scripts\activate
- macOS/Linux:
source myvenv/bin/activate
pip install -r requirements.txtpython3 manage.py migratepython3 manage.py runservercelery -A image_processor worker -l info- After starting the server, you can test the API using the Postman collection:
Endpoint: /upload/
Method: POST
Description: Upload a CSV file containing product information and image URLs. The system validates the CSV, stores the data, and asynchronously processes the images.
Request:
- Headers:
Content-Type: multipart/form-data
- Body:
file: The CSV file to be uploaded. It should contain columnsSerial Number,Product Name, andInput Image Urls.
Response:
- Success (
200 OK): Returns a uniquerequest_idthat can be used to track the status of the image processing.{ "request_id": "123e4567-e89b-12d3-a456-426614174000" } - Error:
- File not provided
- CSV validation failed
- Internal server error
Endpoint: /status/<request_id>/
Method: GET
Description: Check the status of the image processing request using the request_id returned by the upload API.
Request:
- Headers:
Content-Type: application/json
- Parameters:
request_id: UUID of the processing request.
Response:
-
Success (
200 OK):{ "request_id": "1ded0e1c-83a5-4a4f-bcd8-2871bc0b9299", "status": "Completed", "images_processed": 14, "images_total": 14 }or
{ "request_id": "1ded0e1c-83a5-4a4f-bcd8-2871bc0b9299", "status": "Pending", "images_processed": 1, "images_total": 14 } -
Error:
- Wrong
request_id
- Wrong