18 lines
		
	
	
		
			545 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			545 B
		
	
	
	
		
			Python
		
	
	
	
	
	
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')
 |