Skip to main content

csrf plugin for bottle

Project description

csrf support for bottle
#!/usr/bin/env python
#coding: utf-8
__author__ = 'spouk'

from bottle import Bottle, template, TEMPLATE_PATH
from spouk_bottle_csrf import CSRF

CSRF_SALT = 'somesalforcsrf'


# пример декоратора
def mainrender(page, *argc,**kwargs):
result = template(page, *argc, **kwargs)
# app.csrf.csrf_check_after_request(result)
return template(page, *argc, **kwargs)

def root():
print app.csrf.csrf_token, app.csrf.csrf_meta_geting
return mainrender('index.html')'localhost',port=3500, debug=True,reloader=True)

<meta charset="utf-8" />
<meta content="{{app.csrf.csrf_token}}" name="csrf-token">

Csrf_token: {{ app.csrf.csrf_token }} <br />
example visible `hidden` input form: {{ app.csrf.csrf_token_html }} <br />
example `hidden` form: {{ !app.csrf.csrf_token_html }} <br />

Copyleft [x] 2015, Spouk

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for spouk-bottle-csrf, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size spouk-bottle-csrf-0.0.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page