def getOtp( self ): totp = session._tmp_otp totpImg = None if totp is not None: totpImg = 'data:image/png;base64,%s' % pyqrcode.create( totp ).png_as_base64_str( scale = 4 ) return ( totp, totpImg )