예제 #1
0
def getQrCode():
    qr = txt.get()
    myQr = QRCode(qr)
    print(dir(myQr))
    myQr.png("code.png")

    lbl.configure(text="Generated !!")
예제 #2
0
 def console_qr_code(self, uuid, status, qrcode=None):
     status = int(status)
     if self.qr_uuid == (uuid, status):
         return
     self.qr_uuid = (uuid, status)
     if status == 201:
         qr = self._('Confirm on your phone.')
         return self.logger.log(99, qr)
     elif status == 200:
         qr = self._("Successfully logged in.")
         return self.logger.log(99, qr)
     else:
         # 0: First QR code
         # 408: Updated QR code
         qr = self._("EWS: Please scan the QR code with your camera, screenshots will not work. ({0}, {1})") \
                  .format(uuid, status) + "\n"
         if status == 408:
             qr += self._("QR code expired, please scan the new one.") + "\n"
         qr += "\n"
         qr_url = "https://login.weixin.qq.com/l/" + uuid
         qr_obj = QRCode(qr_url)
         if self.flag("imgcat_qr"):
             qr_file = io.BytesIO()
             qr_obj.png(qr_file, scale=10)
             qr_file.seek(0)
             qr += self.imgcat(qr_file, "%s_QR_%s.png" % (self.channel_id, uuid))
         else:
             qr += qr_obj.terminal()
         qr += "\n" + self._("If the QR code was not shown correctly, please visit:\n" \
                             "https://login.weixin.qq.com/qrcode/{0}").format(uuid)
         return self.logger.log(99, qr)
예제 #3
0
    def show_qr_code(qr_id):
        """
        在控制台上打印二维码
        代码取之于WxBot项目中
        link:https://github.com/Urinx/WeixinBot/blob/master/wxbot_demo_py3/weixin.py
        Args:
            qr_id: 二维码ID

        Returns:

        """
        qr_data = QRCode(qr_id).text(1)
        try:
            black = u'\u2588'
            sys.stdout.write(black + '\r')
            sys.stdout.flush()
        except UnicodeEncodeError:
            white = 'MM'
        else:
            white = black
        black = '  '
        block_count = 2
        if abs(block_count) == 0:
            block_count = 1
        white *= abs(block_count)
        if block_count < 0:
            white, black = black, white
        sys.stdout.write(' ' * 50 + '\r')
        sys.stdout.flush()
        qr_code = qr_data.replace('0', white).replace('1', black)
        sys.stdout.write(qr_code)
        sys.stdout.flush()
예제 #4
0
def save_qrcode(string, outdir, file_name=None, error_correct='H'):
    qrcode = QRCode(string, error=error_correct)
    outdir = Path(outdir)
    if file_name is None:
        file_name = f'{string}.png'
    file_path = outdir / file_name
    qrcode.png(file_path, scale=8)
예제 #5
0
 def console_qr_code(self, uuid, status, qrcode):
     status = int(status)
     if status == 201:
         QR = 'Tap "Confirm" to continue.'
         return self.logger.critical(QR)
     elif status == 200:
         QR = "Successfully authorized."
         return self.logger.critical(QR)
     elif uuid != self.qr_uuid:
         # 0: First QR code
         # 408: Updated QR code
         QR = "WeChat: Scan QR code with WeChat to continue. (%s, %s)\n" % (
             uuid, status)
         if status == 408:
             QR += "Previous code expired. Please scan the new one.\n"
         QR += "\n"
         qr_url = "https://login.weixin.qq.com/l/" + uuid
         qr_obj = QRCode(qr_url)
         if self._flag("imgcat_qr", False):
             qr_file = io.BytesIO()
             qr_obj.png(qr_file, scale=10)
             QR += self.imgcat(qr_file,
                               "%s_QR_%s.png" % (self.channel_id, uuid))
         else:
             QR += qr_obj.terminal()
         QR += "\nIf you cannot read the QR code above, " \
               "please visit the following URL:\n" \
               "https://login.weixin.qq.com/qrcode/" + uuid
         return self.logger.critical(QR)
     self.qr_uuid = uuid
예제 #6
0
    def _showQRCodeImg(self, str):
        if self.sendQRCode2Mat:
            url = 'https://login.weixin.qq.com/qrcode/' + self.uuid
            params = {'t': 'webwx', '_': int(time.time())}

            data = self._post(url, params, False)
            if data == '':
                return
            QRCODE_PATH = self._saveFile('qrcode.jpg', data, '_showQRCodeImg')
            self.imgCallback(QRCODE_PATH)
        elif self.commandLineQRCode:
            qrCode = QRCode('https://login.weixin.qq.com/l/' + self.uuid)
            self._showCommandLineQRCode(qrCode.text(1))
        else:
            url = 'https://login.weixin.qq.com/qrcode/' + self.uuid
            params = {'t': 'webwx', '_': int(time.time())}

            data = self._post(url, params, False)
            if data == '':
                return
            QRCODE_PATH = self._saveFile('qrcode.jpg', data, '_showQRCodeImg')
            if str == 'win':
                os.startfile(QRCODE_PATH)
            elif str == 'macos':
                subprocess.call(["open", QRCODE_PATH])
            else:
                return
예제 #7
0
 def get_QR(self, uuid, enableCmdQR=False, picDir=None):
     picDir = picDir or config.DEFAULT_QR
     qrStorage = io.BytesIO()
     qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
     qrCode.png(qrStorage, scale=10)
     with open(picDir, 'wb') as f:
         f.write(qrStorage.getvalue())
     return qrStorage
예제 #8
0
 def get_qr(self):
     push_login(self.core)
     self.core.get_QRuuid()
     uuid = self.core.uuid
     qrStorage = io.BytesIO()
     qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
     qrCode.png(qrStorage, scale=10)
     return qrStorage
예제 #9
0
 def generate_qrcode(self, currency_name, url_link):
     img = QRCode(url_link)
     file_name = os.path.join(bin_path(), currency_name + '.png')
     img.png(file_name)
     pixmap = QPixmap(file_name)
     pixmap = pixmap.scaled(256, 256)
     pixmap.save(file_name)
     self.qrcode_cash[currency_name] = pixmap.toImage()
     return currency_name
예제 #10
0
 def generate(self, string, imagepath=None):
     qr = QRCode(string, error='H')
     path = time.time() * 1000
     qr.png(path, scale=10)
     if (imagepath == None):
         return path
     else:
         self.addImage(path, imagepath)
         return path
예제 #11
0
def get_QR(picDir=None):
    picDir = picDir or 'QR.png'
    qr_storage = io.BytesIO()
    ip = get_host_ip()
    ip_address = ip + ":8000"
    qr_code = QRCode(ip_address)
    qr_code.png(qr_storage, scale=10)
    with open(picDir, 'wb') as f:
        f.write(qr_storage.getvalue())
        print_qr(picDir)
예제 #12
0
def ShowQRCode(strIP, strPort, servertype, tempdir, showtype=0):

    #生成二维码
    global serverVersion
    sInfo = servertype + '-' + serverVersion + '-' + strPort + '-' + strIP
    img = QRCode(sInfo)

    #将二维码保存成文件
    img.png(tempdir + '/qrcode.png', scale=5)

    #准备显示二维码
    qrStorage = io.BytesIO()
    img.png(qrStorage, scale=10)

    #直接显示二维码
    if showtype == 1:
        img.show()
    #二维码在命令行显示
    elif showtype == 2:
        osName = platform.system()
        if osName == 'Windows':
            enableCmdQR = 1
        else:
            enableCmdQR = -2

        print_cmd_qr(img.text(1), enableCmdQR=enableCmdQR)
예제 #13
0
 def open_QR(self):
     self.output_info('Getting uuid')
     uuid = itchat.get_QRuuid()
     while uuid is None:
         uuid = itchat.get_QRuuid()
         time.sleep(1)
     self.output_info('Getting QR Code')
     qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
     qrCode.png("QR.png", scale=10)
     self.programSignal.getting_QR.emit()
     return uuid
예제 #14
0
    def _mkqrcode(self, idents):
        """Generates the actual QR code"""
        if idents is not None:
            url = self._base_url.format(*idents)
        else:
            url = self._base_url

        qrcode = QRCode(url)

        with NamedTemporaryFile('rb', suffix='.png') as tmp:
            qrcode.png(tmp.name, self._scale)
            tmp.seek(0)
            qr_data = tmp.read()

        return qr_data
def CreatePrintable(request):
    try:
        # A4 page dimensions in pixels @ 300 dpi, QR code will be 248 px x 248 px + 47 px for text
        # 110 qr codes per page

        # get items ids
        idList = request.GET.getlist('id')

        # check if the number of ids is lower or equal to 110, which is max amount of codes per page
        if len(idList) > 110:
            return Response("", status.HTTP_400_BAD_REQUEST)

        codes = Image.new('RGB', (2480, 3508), (255, 255, 255))
        draw = ImageDraw.Draw(codes)

        # using default PIL font until the issue with reading font from file is resolved
        font = ImageFont.load_default()
        finalImage = io.BytesIO()

        # str to int
        for x in idList:
            x = int(x)

        X = Y = itemCount = 0
        for qrid in idList:
            buffer = io.BytesIO()  # here, otherwise qr codes are the same
            qr = QRCode(qrid)
            qr.png(buffer, scale=6)

            qrcodeimage = Image.open(buffer).resize((248, 248))
            codes.paste(qrcodeimage, (X, Y))  # paste code into image
            draw.text((X, Y + 248), str(qrid), (0, 0, 0),
                      font=font)  # draw text under code

            # calculate new position
            X += 248
            itemCount += 1
            if itemCount % 10 == 0:  # next line
                Y += 293  # originally 295, but the text gets cut off at the last line
                X = 0

        codes.save(finalImage, format="PNG")
        return HttpResponse(finalImage.getvalue(), content_type="image/png")

    except MultiValueDictKeyError:
        return Response("id parameter was not provided", status.HTTP_400_BAD_REQUEST)
    except ValueError as e:
        return Response("Wrong id: {}".format(str(e)), status.HTTP_400_BAD_REQUEST)
예제 #16
0
    def master_qr_code(self, uuid, status, qrcode=None):
        status = int(status)
        if self.qr_uuid == (uuid, status):
            return
        self.qr_uuid = (uuid, status)

        msg = EFBMsg()
        msg.uid = f"ews_auth_{uuid}_{status}"
        msg.type = MsgType.Text
        msg.chat = EFBChat(self).system()
        msg.chat.chat_name = self._("EWS User Auth")
        msg.author = msg.chat
        msg.deliver_to = coordinator.master

        if status == 201:
            msg.type = MsgType.Text
            msg.text = self._('Confirm on your phone.')
        elif status == 200:
            msg.type = MsgType.Text
            msg.text = self._("Successfully logged in.")
        elif uuid != self.qr_uuid:
            msg.type = MsgType.Image
            file = NamedTemporaryFile(suffix=".png")
            qr_url = "https://login.weixin.qq.com/l/" + uuid
            QRCode(qr_url).png(file, scale=10)
            msg.text = self._("QR code expired, please scan the new one.")
            msg.path = file.name
            msg.file = file
            msg.mime = 'image/png'
        if status in (200, 201) or uuid != self.qr_uuid:
            coordinator.send_message(msg)
예제 #17
0
파일: wechat.py 프로젝트: Walt105/EDwechat
    def open_qr(self):
        print('Getting uuid')
        uuid = itchat.get_QRuuid()
        self.uuid = uuid
        while uuid is None:
            uuid = itchat.get_QRuuid()
            time.sleep(1)
        print('Getting QR Code')

        qrStorage = io.BytesIO()
        qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
        qrCode.png(qrStorage, scale=6)
        with open(self.picDir, 'wb') as f:
            f.write(qrStorage.getvalue())
        print('Please scan the QR Code')
        return uuid
예제 #18
0
def _create_qr_base64(content: str) -> str:
    """Create a base64 valid str format to render in html with
    the passed content.

    Params:
    -------
    - content: str - The info to encode.

    Return:
    -------
    - qr_code: Encoded QR code.
    """
    qr_instance = QRCode(content)
    qr_srt_base64 = qr_instance.png_as_base64_str(scale=8)
    qr_code = f"data:image/png;base64,{qr_srt_base64}"
    return qr_code
예제 #19
0
파일: login.py 프로젝트: hcwnbs/small
def get_QR(self, uuid=None, enableCmdQR=False, picDir=None, qrCallback=None):
    uuid = uuid or self.uuid
    picDir = picDir or config.DEFAULT_QR
    qrStorage = io.BytesIO()
    qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
    qrCode.png(qrStorage, scale=10)
    if hasattr(qrCallback, '__call__'):
        qrCallback(uuid=uuid, status='0', qrcode=qrStorage.getvalue())
    else:
        if enableCmdQR:
            utils.print_cmd_qr(qrCode.text(1), enableCmdQR=enableCmdQR)
        else:
            with open(picDir, 'wb') as f:
                f.write(qrStorage.getvalue())
            utils.print_qr(picDir)
    return qrStorage
예제 #20
0
    def setup_message(self):
        """Print setup message to console.

        For QRCode `base36`, `pyqrcode` are required.
        Installation through `pip install HAP-python[QRCode]`
        """
        pincode = self.driver.state.pincode.decode()
        if SUPPORT_QR_CODE:
            xhm_uri = self.xhm_uri()
            print("Setup payload: {}".format(xhm_uri), flush=True)
            print("Scan this code with your HomeKit app on your iOS device:",
                  flush=True)
            print(QRCode(xhm_uri).terminal(quiet_zone=2), flush=True)
            print(
                "Or enter this code in your HomeKit app on your iOS device: "
                "{}".format(pincode),
                flush=True,
            )
        else:
            print(
                "To use the QR Code feature, use 'pip install "
                "HAP-python[QRCode]'",
                flush=True,
            )
            print(
                "Enter this code in your HomeKit app on your iOS device: {}".
                format(pincode),
                flush=True,
            )
예제 #21
0
파일: login.py 프로젝트: wu-yy/ItChat
def get_QR(self, uuid=None, enableCmdQR=False, picDir=None, qrCallback=None):
    uuid = uuid or self.uuid
    picDir = picDir or config.DEFAULT_QR
    qrStorage = io.BytesIO()
    qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
    qrCode.png(qrStorage)
    if hasattr(qrCallback, '__call__'):
        qrCallback(uuid=uuid, status='0', qrcode=qrStorage.getvalue())
    else:
        if enableCmdQR:
            utils.print_cmd_qr(qrCode.text(1), enableCmdQR=enableCmdQR)
        else:
            with open(picDir, 'wb') as f:
                f.write(qrStorage.getvalue())
            utils.print_qr(picDir)
    return qrStorage
예제 #22
0
    def master_qr_code(self, uuid, status, qrcode=None):
        status = int(status)
        msg = EFBMsg()
        msg.type = MsgType.Text
        msg.chat = EFBChat(self).system()
        msg.chat.chat_name = self._("EWS User Auth")
        msg.author = msg.chat
        msg.deliver_to = coordinator.master

        if status == 201:
            msg.type = MsgType.Text
            msg.text = self._('Confirm on your phone.')
        elif status == 200:
            msg.type = MsgType.Text
            msg.text = self._("Successfully logged in.")
        elif uuid != self.qr_uuid:
            msg.type = MsgType.Image
            # path = os.path.join("storage", self.channel_id)
            # if not os.path.exists(path):
            #     os.makedirs(path)
            # path = os.path.join(path, 'QR-%s.jpg' % int(time.time()))
            # self.logger.debug("master_qr_code file path: %s", path)
            file = NamedTemporaryFile(suffix=".png")
            qr_url = "https://login.weixin.qq.com/l/" + uuid
            QRCode(qr_url).png(file, scale=10)
            msg.text = self._("QR code expired, please scan the new one.")
            msg.path = file.name
            msg.file = file
            msg.mime = 'image/png'
        if status in (200, 201) or uuid != self.qr_uuid:
            coordinator.send_message(msg)
            self.qr_uuid = uuid
예제 #23
0
def get_QR(self, uuid=None):
    uuid = uuid or self.uuid
    # picDir = picDir or config.DEFAULT_QR
    qrStorage = io.BytesIO()
    qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
    qrCode.png(qrStorage, scale=10)
    # if hasattr(qrCallback, '__call__'):
    #     qrCallback(uuid=uuid, status='0', qrcode=qrStorage.getvalue(), extra_dict)
    # else:
    #     if enableCmdQR:
    #         utils.print_cmd_qr(qrCode.text(1), enableCmdQR=enableCmdQR)
    #     else:
    #         with open(picDir, 'wb') as f:
    #             f.write(qrStorage.getvalue())
    #         utils.print_qr(picDir)
    return qrStorage
예제 #24
0
def main():

    setupCode = generateSetupCode()
    setupId = generateSetupId()
    setupURI = xhmURI(setupId, setupCode)

    configPath = sys.argv[1]
    qrcodePath = sys.argv[2]

    with open(configPath, "w") as config:
        config.write("// Generated pairing information. Use \"make homekitSettings\" to generate.\n\n")
        config.write("#define SETUP_CODE \"{0}\"\n".format(setupCode))
        config.write("#define SETUP_ID \"{0}\"\n".format(setupId))
        config.write("// URI is\"{0}\"\n\n".format(xhmURI(setupId, setupCode)))

    try:
        import png
        import pyqrcode
        from pyqrcode import QRCode

        QRCode(setupURI).png(qrcodePath, scale=5)

    except ImportError, err:
            print 'Can not find a required module for QR-Code generation:', err
            print 'Install it using \"pip install pyqrcode pypng\".\n'
예제 #25
0
 def master_qr_code(self, uuid, status, qrcode):
     status = int(status)
     msg = EFBMsg(self)
     msg.type = MsgType.Text
     msg.source = MsgSource.System
     msg.origin = {
         'name': '%s Auth' % self.channel_name,
         'alias': '%s Auth' % self.channel_name,
         'uid': -1
     }
     if status == 201:
         msg.type = MsgType.Text
         msg.text = 'Tap "Confirm" to continue.'
     elif status == 200:
         msg.type = MsgType.Text
         msg.text = "Successfully authenticated."
     elif uuid != self.qr_uuid:
         msg.type = MsgType.Image
         path = os.path.join("storage", self.channel_id)
         if not os.path.exists(path):
             os.makedirs(path)
         path = os.path.join(path, 'QR-%s.jpg' % int(time.time()))
         self.logger.debug("master_qr_code file path: %s", path)
         qr_url = "https://login.weixin.qq.com/l/" + uuid
         QRCode(qr_url).png(path, scale=10)
         msg.text = 'Scan this QR Code with WeChat to continue.'
         msg.path = path
         msg.file = open(path, 'rb')
         msg.mime = 'image/jpeg'
     if status in (200, 201) or uuid != self.qr_uuid:
         self.queue.put(msg)
         self.qr_uuid = uuid
예제 #26
0
파일: app.py 프로젝트: sepidehbyt/ThesisPy
def next_qr():
    session_id = request.args.get('sessionId')
    try:
        with connection.cursor() as cursor:
            random_num = random.randint(10000, 99999)
            qr_string = "_{}_{}".format(session_id, random_num)
            qr_code = QRCode(qr_string)
            qr_code.svg('C:\Apache24\htdocs\qr.svg', scale=5)
            sql = "update session set qr = %s, updated_at = %s where id = %s"
            now = datetime.datetime.now()
            time_format = now.strftime("%Y-%m-%d %H:%M:%S")
            cursor.execute(sql, (qr_string, time_format, session_id))
            connection.commit()
    except Exception as exception:
        return exception
    finally:
        return "http://localhost/qr.svg"
예제 #27
0
def qualitize(avy):
    urls = ["http://www.feedmusic.com/", "https://crypton.trading/", "http://www.etq-amsterdam.com/", "http://www.mikiyakobayashi.com/", \
            "https://insideabbeyroad.withgoogle.com/en", "https://www.thenewmobileworkforce.com/", "http://education.iceandsky.com/", \
            "https://getbeagle.co/", "https://www.southwestheartoftravel.com/", "http://wovenmagazine.com/", "http://www.johos.at/", \
            "https://www.nowness.com/", "https://www.virginamerica.com/", "http://www.world-of-swiss.com/en", "http://reductress.com/"]
    url = QRCode(random.choice(urls), error='H')
    url.png('test.png', scale=10)
    with Image.open('test.png').convert("RGBA") as im:
        box = (135, 135, 235, 235)
        im.crop(box)
        avy = Image.open(avy)
        avy = avy.resize((box[2] - box[0], box[3] - box[1]))
        im.paste(avy, box)
        out = BytesIO()
        im.save(out, format="png")
    out.seek(0)
    return out
예제 #28
0
    def getQr(self):
        # 获取请求UUID URL地址
        get_qr_url = self.config["qr_uuid"] % time.time()
        # 获取UUID
        self.uuid = RequestUtils.getDefault().sendGet(get_qr_url).text.split(
            "\"")[1]
        if (self.uuid == None):
            print("获取UUID失败")
            return

        try:
            # 获取二维码成功
            qrCode = QRCode('https://login.weixin.qq.com/l/' + self.uuid)
            self._showCommandLineQRCode(qrCode.text(1))
            return True
        except:
            print("写入文件失败")
예제 #29
0
def msg(update: Update, context: CallbackContext) -> None:
    """Send Any text or url to get a qr code for it"""
    text = update.message.text
    message_id = update.message.message_id
    qr_file = f'{message_id}.png'
    try:
        update.message.reply_text("Generating")
        Qr_Code = QRCode(text)
        Qr_Code.png(qr_file, scale=10)
        update.message.reply_photo(
            photo=open(qr_file, "rb"),
            reply_to_message_id=message_id,
            caption=f"Here is Your Qr code for '{text}'")
        update.message.reply_text("Finished")
        os.remove(qr_file)
    except Exception:
        update.message.reply_text("Please Try Agian Later")
예제 #30
0
def home():
    qr_file_name = None
    if request.method == 'POST':
        form = UserTextField(request.form)
        if form.validate():
            qr_code = QRCode(form.data['text'], encoding='utf-8')
            qr_file_name = 'tmp/' + datetime.datetime.now().strftime(
                '%Y%m%d%H%M') + '.png'
            qr_code.png(qr_file_name, scale=5)
            if form.data['mode'] == 'download':
                return redirect(qr_file_name)
    else:
        form = UserTextField()

    return render_template(
        'index.html',
        form=form,
        link=qr_file_name,
    )
예제 #31
0
파일: app.py 프로젝트: saumya1906/Movehack
def charge():
    # Amount in cents
    # amount = 500*100
    global key_qr
    global cost_amount
    customer = stripe.Customer.create(email=request.form['custemail'],
                                      source=request.form['stripeToken'])

    charge = stripe.Charge.create(customer=customer.id,
                                  amount=cost_amount,
                                  currency='usd',
                                  description='Flask Charge')
    # key_qr = "dsguik"
    qr_file_name = None

    qr_code = QRCode(key_qr, encoding='utf-8')
    qr_file_name = 'static/images/rand.png'
    qr_code.png(qr_file_name, scale=5)
    fname = "/static/images/rand.png"
    return render_template('final.html', amount=cost_amount, link=fname)
예제 #32
0
def print_QRImage():
    global tip
    #url = 'https://login.weixin.qq.com/qrcode/' + uuid
    qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
    printCode = qrCode.terminal(quiet_zone=1)
    # if sys.platform.find('win') >= 0:
    # printCode = printCode.encode("UTF-8").decode("GB2312")
    # # printCode = re.replace(""," ")
    # # printCode = re.replace("","█")
    print(printCode)
    params = {
        't': 'webwx',
        '_': int(time.time()),
    }
    #断点
    sys.exit()
    # r = myRequests.get(url=url, params=params)
    # print(r.content)
    # tip = 1
    print('请使用微信扫描二维码以登录')
예제 #33
0
파일: report.py 프로젝트: pukonu/doas
    def __init__(self, title=None, footer=None, company=None, order=None, to=None, table=None, template=None,
                 filename=None, request=None):

        self.title = title
        self.footer = footer if footer is not None else self.footer
        self.company = company if company is not None else self.company
        self.order = order if order is not None else self.order
        self.to = to if to is not None else self.to
        self.table = table if table is not None else self.table

        self.template = template if template is not None else self.template
        self.filename = filename if filename is not None else self.filename
        self.request = request

        # create qrcode if qrcode is not none
        if footer['qrcode'] is not None:
            qrc = QRCode(footer['qrcode'])
            qrcode = "%s/%s" % (settings.MEDIA_ROOT, self.filename.split('.pdf')[0]+".png")
            qrc.png(qrcode, scale=9)
            footer['qrcode'] = qrcode
예제 #34
0
파일: weixin.py 프로젝트: Jolly23/WeixinBot
    def _showQRCodeImg(self, str):
        if self.commandLineQRCode:
            qrCode = QRCode('https://login.weixin.qq.com/l/' + self.uuid)
            self._showCommandLineQRCode(qrCode.text(1))
        else:
            url = 'https://login.weixin.qq.com/qrcode/' + self.uuid
            params = {
                't': 'webwx',
                '_': int(time.time())
            }

            data = self._post(url, params, False)
            if data == '':
                return
            QRCODE_PATH = self._saveFile('qrcode.jpg', data, '_showQRCodeImg')
            if str == 'win':
                os.startfile(QRCODE_PATH)
            elif str == 'macos':
                subprocess.call(["open", QRCODE_PATH])
            else:
                return
예제 #35
0
from pyqrcode import QRCode
url = QRCode('http://www.ntu.edu.tw')
url.png('url.png', scale=10)