ebanutsya
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from routes.auth import auth_blueprint
|
||||
from routes.orders import orders_blueprint
|
||||
from routes.barcode import barcode_blueprint
|
||||
from routes.printing import printing_blueprint
|
||||
|
||||
17
routes/printing.py
Normal file
17
routes/printing.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from flask import Blueprint, request, send_file
|
||||
from routes.utils import jwt_protect_blueprint
|
||||
import sipro.api.printing
|
||||
|
||||
printing_blueprint = jwt_protect_blueprint(Blueprint('printing', __name__))
|
||||
|
||||
|
||||
@printing_blueprint.get('/getLabel')
|
||||
def get_label():
|
||||
args = request.args
|
||||
order_id = args.get('orderId')
|
||||
data = sipro.api.printing.get_label(order_id)
|
||||
data.seek(0)
|
||||
return send_file(data,
|
||||
as_attachment=True,
|
||||
download_name='label.pdf',
|
||||
mimetype='application/pdf')
|
||||
Reference in New Issue
Block a user