Skip to content

Instantly share code, notes, and snippets.

@sanjeevsiva17
Last active December 29, 2022 03:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanjeevsiva17/8d79f6a4f4e67c07f0a4653e52e61288 to your computer and use it in GitHub Desktop.
Save sanjeevsiva17/8d79f6a4f4e67c07f0a4653e52e61288 to your computer and use it in GitHub Desktop.
Python server for zpl
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