How to use the bottle.request.forms.get function in bottle

To help you get started, we’ve selected a few bottle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github morpheus65535 / oscarr / oscarr.py View on Github external
settings_sonarr_ssl = 'False'
    else:
        settings_sonarr_ssl = 'True'
    settings_sonarr_apikey = request.forms.get('settings_sonarr_apikey')
    c.execute("UPDATE table_settings_sonarr SET ip = ?, port = ?, base_url = ?, ssl = ?, apikey = ?, enabled = ?", (settings_sonarr_ip, settings_sonarr_port, settings_sonarr_baseurl, settings_sonarr_ssl, settings_sonarr_apikey, settings_sonarr_enabled))

    settings_radarr_enabled = request.forms.get('settings_radarr_enabled')
    settings_radarr_ip = request.forms.get('settings_radarr_ip')
    settings_radarr_port = request.forms.get('settings_radarr_port')
    settings_radarr_baseurl = request.forms.get('settings_radarr_baseurl')
    settings_radarr_ssl = request.forms.get('settings_radarr_ssl')
    if settings_radarr_ssl is None:
        settings_radarr_ssl = 'False'
    else:
        settings_radarr_ssl = 'True'
    settings_radarr_apikey = request.forms.get('settings_radarr_apikey')
    c.execute("UPDATE table_settings_radarr SET ip = ?, port = ?, base_url = ?, ssl = ?, apikey = ?, enabled = ?", (settings_radarr_ip, settings_radarr_port, settings_radarr_baseurl, settings_radarr_ssl, settings_radarr_apikey, settings_radarr_enabled))

    settings_bazarr_enabled = request.forms.get('settings_bazarr_enabled')
    settings_bazarr_ip = request.forms.get('settings_bazarr_ip')
    settings_bazarr_port = request.forms.get('settings_bazarr_port')
    settings_bazarr_baseurl = request.forms.get('settings_bazarr_baseurl')
    c.execute("UPDATE table_settings_bazarr SET ip = ?, port = ?, base_url = ?, enabled = ?", (settings_bazarr_ip, settings_bazarr_port, settings_bazarr_baseurl, settings_bazarr_enabled))

    conn.commit()
    c.close()

    logging.info('Settings saved succesfully.')
    
    redirect(ref)
github PhotoBackup / server-bottle / photobackup_bottle / photobackup.py View on Github external
def validate_password(request, isTest=False):
    """ Validates the password given in the request
        against the stored Bcrypted one. """
    password = None
    try:
        password = request.forms.get('password').encode('utf-8')
    except AttributeError:
        return end(403, "No password in request")

    if 'PasswordBcrypt' in config:
        passcrypt = config['PasswordBcrypt'].encode('utf-8')
        if bcrypt.hashpw(password, passcrypt) != passcrypt:
            return end(403, "wrong password!")
    elif 'Password' in config and config['Password'] != password:
        return end(403, "wrong password!")
    elif isTest:
        return end(401, "There's no password in server configuration!")
github Othernet-Project / librarian / librarian / librarian_library / routes / downloads.py View on Github external
def manage_downloads():
    """ Manage the downloaded content """
    action_handlers = {'add': add,
                       'add_all': add_all,
                       'delete': delete,
                       'delete_all': delete_all}
    action = request.forms.get('action')
    file_list = request.forms.getall('selection')
    try:
        handler = action_handlers[action]
    except KeyError:
        # Translators, used as error title shown to user when wrong action
        # code is submitted to server
        title = _("Invalid action")
        # Translators, used as error message shown to user when wrong action
        # code is submitted to server
        message = _('Invalid action, please use one of the form buttons.')
        status = 'error'
        feedback = dict(page_title=title,
                        message=message,
                        redirect_url=i18n_url('downloads:list'),
                        redirect_target=_("Updates"))
    else:
github dmpop / gphoto2-bottle / gphoto2-bottle.py View on Github external
@route('/trigger')
@route('/trigger', method='POST')
def switch():
    if (request.POST.get("trigger")):
        trigger()
    if (request.POST.get("start")):
        i = 1
        number = int(request.forms.get('number'))
        interval = int(request.forms.get('interval'))
        while (i <= number):
            trigger()
            time.sleep(interval)
            i = i + 1
    if (request.POST.get("stop")):
            try:
                GPIO.output(27, False)
            except:
                print "RPi.GPIO library is not installed."
            os.system("killall -KILL python")
    if (request.POST.get("shutdown")):
            os.system("sudo halt")
    output = template('trigger.tpl')
    return output
github morpheus65535 / bazarr / bazarr / main.py View on Github external
settings.radarr.ip = text_type(settings_radarr_ip)
    settings.radarr.port = text_type(settings_radarr_port)
    settings.radarr.base_url = text_type(settings_radarr_baseurl)
    settings.radarr.ssl = text_type(settings_radarr_ssl)
    settings.radarr.apikey = text_type(settings_radarr_apikey)
    settings.radarr.only_monitored = text_type(settings_radarr_only_monitored)
    settings.radarr.full_update = text_type(settings_radarr_sync)
    settings.radarr.full_update_day = text_type(settings_radarr_sync_day)
    settings.radarr.full_update_hour = text_type(settings_radarr_sync_hour)

    settings_subliminal_providers = request.forms.getall('settings_subliminal_providers')
    settings.general.enabled_providers = u'' if not settings_subliminal_providers else ','.join(
        settings_subliminal_providers)
    
    settings_addic7ed_random_agents = request.forms.get('settings_addic7ed_random_agents')
    if settings_addic7ed_random_agents is None:
        settings_addic7ed_random_agents = 'False'
    else:
        settings_addic7ed_random_agents = 'True'
    
    settings_opensubtitles_vip = request.forms.get('settings_opensubtitles_vip')
    if settings_opensubtitles_vip is None:
        settings_opensubtitles_vip = 'False'
    else:
        settings_opensubtitles_vip = 'True'
    
    settings_opensubtitles_ssl = request.forms.get('settings_opensubtitles_ssl')
    if settings_opensubtitles_ssl is None:
        settings_opensubtitles_ssl = 'False'
    else:
        settings_opensubtitles_ssl = 'True'
github morpheus65535 / bazarr / bazarr / main.py View on Github external
def perform_manual_upload_subtitle_movie():
    authorize()
    ref = request.environ['HTTP_REFERER']

    moviePath = request.forms.get('moviePath')
    sceneName = request.forms.get('sceneName')
    language = request.forms.get('language')
    forced = True if request.forms.get('forced') == '1' else False
    upload = request.files.get('upload')
    radarrId = request.forms.get('radarrId')
    title = request.forms.get('title')

    _, ext = os.path.splitext(upload.filename)

    if ext not in SUBTITLE_EXTENSIONS:
        raise ValueError('A subtitle of an invalid format was uploaded.')

    try:
        result = manual_upload_subtitle(path=moviePath,
                                        language=language,
                                        forced=forced,
github viper-framework / viper / viper-api.py View on Github external
def run_module():
    project = request.forms.get('project')
    sha256 = request.forms.get('sha256')
    cmd_line = request.forms.get('cmdline')

    if project:
        __project__.open(project)
    else:
        __project__.open('../')

    if sha256:
        file_path = get_sample_path(sha256)
        if file_path:
            __sessions__.new(file_path)

    if not cmd_line:
        response.code = 404
        return jsonize({'message': 'Invalid command line'})

    results = module_cmdline(cmd_line, sha256)
github ConceptPending / hn4hn4x / server.py View on Github external
def resend_auth_link():
    user_email = cgi.escape(request.forms.get('user_email'))
    user_auth = random_string(32)
    cur = connect_db()
    cur.execute("UPDATE hnc_users SET user_auth = %s WHERE user_email = %s RETURNING user_id;", (user_auth, user_email))
    send_email('hn4hn4x@gmail.com', user_email, 'Log-in for Hacker News for "Hacker News for X"', gen_welcome_email(user_name, user_auth))