def qrcode(payload):
	if args.verbose:
		logging.getLogger("qrcode").setLevel(logging.DEBUG)
		logging.getLogger("qrcode").addHandler(logging.StreamHandler(sys.stdout))

	encoded = QRCodeEncoder(payload)
	encoded.save(args.outfile, 3)
Beispiel #2
0
def qrcodegenerate():
    qrtext = request.form['text1']
    encoder = QRCodeEncoder(qrtext)
    encoder.save(os.path.join(app.config['QR_DIR'], 'test.png'), 3)
    image_src = os.path.join(app.config['QR_DIR'], 'test.png')
    data_uri = base64.b64encode(open(image_src, 'rb').read()).decode('utf-8')
    return render_template("generate.html", qr_img=data_uri)
Beispiel #3
0
def qrcode(payload):
    if args.verbose:
        logging.getLogger("qrcode").setLevel(logging.DEBUG)
        logging.getLogger("qrcode").addHandler(
            logging.StreamHandler(sys.stdout))

    encoded = QRCodeEncoder(payload)
    encoded.save(args.outfile, 3)
Beispiel #4
0
    def test_against_generated(self):
        """Compare the output of this library with generated barcodes"""

        i = 1
        for string in QRTest.test_strings:
            encoder = QRCodeEncoder(string, 'M')
            encoder.save('test.png', 3)

            import filecmp
            self.assertTrue(filecmp.cmp('test.png',
                                        'pystrich/qrcode/test_img/%d.png' % i))
            i += 1
Beispiel #5
0
#!/usr/bin/env python
"""Example code for qrcode library"""
__revision__ = "$Revision$"

from pystrich.qrcode import QRCodeEncoder
import sys
import logging

logging.getLogger("qrcode").setLevel(logging.DEBUG)
logging.getLogger("qrcode").addHandler(logging.StreamHandler(sys.stdout))

if __name__ == "__main__":
    ENCODER = QRCodeEncoder(sys.argv[1])
    ENCODER.save("test.png", 3)
    print(ENCODER.get_ascii())
    with open("test.dxf", "w") as text_file:
        text_file.write(ENCODER.get_dxf(inverse=False, cellsize=0.1))
Beispiel #6
0
#!/usr/bin/env python
"""Example code for qrcode library"""
__revision__ = "$Revision$"

from pystrich.qrcode import QRCodeEncoder
import sys
import logging

logging.getLogger("qrcode").setLevel(logging.DEBUG)
logging.getLogger("qrcode").addHandler(logging.StreamHandler(sys.stdout))

if __name__ == "__main__":
    ENCODER = QRCodeEncoder(sys.argv[1])
    ENCODER.save("test.png", 3)
    print(ENCODER.get_ascii())