repl.it
@functorflow/

invoice-ws

Python

No description

fork
loading
Files
  • main.py
  • static
  • templates
  • Packager files
  • poetry.lock
  • pyproject.toml
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask, render_template, url_for, request
from flask_weasyprint import HTML, render_pdf
from datetime import datetime


app = Flask('app')

@app.route('/')
def invoice():
  ctx = {}
  ctx['css_url'] = url_for('static', filename='invoice.css')
  ctx['name'] = request.args.get('name', "Samandar Sobir ugli Ravshanov")
  ctx['passport'] = request.args.get('passport', "AA2008681")
  ctx['wallet'] = request.args.get('wallet', "2490793386874352")
  ctx['status'] = request.args.get('status',"Верифицирован")
  ctx['amount'] = request.args.get('amount', "350,000")
  ctx['invoice'] = request.args.get('invoice', "ABCD-1234")
  date = datetime.date(datetime.now())
  ctx['date'] = request.args.get('date', date.isoformat())


  html = render_template('invoice.html', **ctx)
  return render_pdf(HTML(string=html))



app.run(host='0.0.0.0', port=8080)

# http://flask.palletsprojects.com/en/1.1.x/quickstart/#variable-rules
?