Here is my code in myclass.py
class Pdf():
def render_pdf(self,name,html):
from xhtml2pdf import pisa
from StringIO import StringIO
pdf = StringIO()
pisa.CreatePDF(StringIO(html), pdf)
return pdf
And I am calling it in api.py like this
@app.route('/invoice/<business_name>/<tin>', methods=['GET'])
def view_invoice(business_name,tin):
#pdf = StringIO()
html = render_template('certificate.html', business_name=business_name,tin=tin)
file_class = Pdf()
pdf = file_class.render_pdf(business_name,html)
return pdf
But it throws this error
AttributeError: StringIO instance has no __call__ method