def create_meCard(): # Some params accept multiple values, like email, phone, url qr = helpers.make_mecard(name=input_data['user_name'], email=input_data['email'], phone=input_data['phone'], url=input_data['url']) qr.save(os.path.join(os.getcwd(), 'images', 'outputs', 'qrcodes', 'qrcode_mcard.png'), scale=4)
def get_full_qrcode(n, ln, e, u, p): """ It will return a .svg QR Code file n = First Name l = Last Name e = E-mail u = URL. Do not use http:// or https://. Only your domain name, example: mydomain.com p = phone """ qr = helpers.make_mecard(name=ln+","+n, email=e, url=u, phone=p) qr.save(str(n)+"_"+str(ln)+".png", scale=10, dark="darkblue")
def index(request): if request.method == "POST": name = request.POST['name'] phone = request.POST['phone'] email = request.POST['email'] qr = helpers.make_mecard(name, phone, email) qr.save('qr.png', scale=10) img = open('qr.png', 'rb').read() # return HttpResponse(f'数据提交: {name},{phone},{email}') return HttpResponse(img, content_type='image/png') return render(request, 'index.html')
def test_mecard(): qr = helpers.make_mecard(name='Mustermann,Max') assert qr
def test_mecard(): qr = helpers.make_mecard(name='Mustermann,Max') assert qr
from segno import helpers qr = helpers.make_mecard( name='pyhui', email='*****@*****.**', phone='110' ) qr.save('pyhui电话.png', scale=10)