Last active
December 29, 2022 03:13
-
-
Save sanjeevsiva17/8d79f6a4f4e67c07f0a4653e52e61288 to your computer and use it in GitHub Desktop.
Python server for zpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify | |
import json | |
from printToPrinter import printToPrnter | |
import textwrap | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello, World!. I like to print' | |
@app.route('/print', methods=['POST']) | |
def print(): | |
content = request.get_json() | |
response = printToPrinter(content['name'], content['city']) | |
return json.dumps(response) | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment