Skip to main content

Flask-Split-JS version 0.2.1

https://travis-ci.org/FelixLoether/flask-split-js.png?branch=master

Flask-Split-JS offers utilities for using Flask-Split from the browser using JavaScript.

Setup

On top of the Flask-Split setup, you need to register the Flask-Split-JS blueprint to your application:

from flask import Flask
from flask.ext.split_js import split_js

app = Flask(__name__)
app.register_blueprint(split_js)

and add the JavaScript library to your template:

<script src="/path/to/jquery.js"></script>
<script src="{{ url_for('static/js/flask-split.min.js') }}"></script>

jQuery is required for the JavaScript library to work.

API Reference

FlaskSplit.ab_test(experiment_name, alternatives, callback)

A port of Flask-Split’s ab_test function. When the alternative has been decided, the callback function is called with the chosen alternative as its sole argument. In case an error occured with the request, the callback is called with undefined as its first argument and the jQuery response object as its second argument.

Invalid arguments cause errors to be thrown.

experiment_name

Name of the experiment. A string with a minimun length of 1.

alternatives

A list with the alternatives. All alternatives must be strings with a minimum length of 1.

callback

A function to be called on success or on failure. Should take two arguments: the chosen alternative and the error.

FlaskSplit.finished(experiment_name, reset=true)

A port of Flask-Split’s finished function.

Invalid arguments cause errors to be thrown.

experiment_name

Name of the experiment. A string with a minimum length of 1.

reset

Whether or not the experiment should be reset for the user. Defaults to true.

Resources

Changes

A list of changes done in each version.

0.2.1

  • Fixed a ReferenceError in the JS that occured because module was not defined.

  • Added a missing var to the JS.

0.2.0

  • Fixed a bug with the functions not sending the data to the server in the correct format.

  • Changed FlaskSplit.ab_test to take the alternatives as a single list argument (i.e. ab_test('exp', 'a', 'b', callback) -> ab_test('exp', ['a', 'b'], callback)).

  • The callback to ab_test will now be called also when the request fails. In this case the first argument is undefined and the second argument is the jQuery response object.

0.1.0

Initial release.

Release files for Flask-Split-JS 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Split-JS 0.2.1
File Size Uploaded
Flask-Split-JS-0.2.1.tar.gz 7.0 kB Details

Release files / Flask-Split-JS-0.2.1.tar.gz

Download URL Flask-Split-JS-0.2.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bc47960d92a320b33c836675b299637f51936c4c4d3cad3d75fc69f524bed47c
BLAKE2b-256 checksum
How to use checksums
6237d9d48806aa2d4716b56acaf8b168b3e8c5d424125eddf252389a874740b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page