bull package

Submodules

bull.bull module

Bull is a library used to sell digital products on your website. It’s meant to be run on the same domain as your sales page, making analytics tracking trivially easy.

class bull.bull.LoginForm(formdata=<class flask_wtf.form._Auto at 0x1083ecb48>, obj=None, prefix='', csrf_context=None, secret_key=None, csrf_enabled=None, *args, **kwargs)

Bases: flask_wtf.form.Form

Form class for user login.

email = <UnboundField(TextField, ('email',), {'validators': [<wtforms.validators.DataRequired object at 0x10841ee50>]})>
password = <UnboundField(PasswordField, ('password',), {'validators': [<wtforms.validators.DataRequired object at 0x10841eed0>]})>
bull.bull.buy()

Facilitate the purchase of a product.

bull.bull.download_file(purchase_uuid)

Serve the file associated with the purchase whose ID is purchase_uuid.

Parameters:purchase_uuid (str) – Primary key of the purchase whose file we need to serve
bull.bull.login()

For GET requests, display the login form. For POSTS, login the current user by processing the form.

bull.bull.logout(*args, **kwargs)

Logout the current user.

bull.bull.reports(*args, **kwargs)

Run and display various analytics reports.

bull.bull.test(product_id)

Return a test page for live testing the “purchase” button.

Parameters:product_id (int) – id (primary key) of product to test.
bull.bull.user_loader(user_id)

Given user_id, return the associated User object.

Parameters:user_id (unicode) – user_id (email) user to retrieve

bull.models module

Database models for the Bull application.

class bull.models.Product(**kwargs)

Bases: flask_sqlalchemy.Model

A digital product for sale on our site.

Parameters:
  • id (int) – Unique id for this product
  • name (str) – Human-readable name of this product
  • file_name (str) – Path to file this digital product represents
  • version (str) – Optional version to track updates to products
  • is_active (bool) – Used to denote if a product should be considered for-sale
  • price (float) – Price of product
file_name
id
is_active
name
price
version
class bull.models.Purchase(**kwargs)

Bases: flask_sqlalchemy.Model

Contains information about the sale of a product.

Parameters:
  • uuid (str) – Unique ID (and URL) generated for the customer unique to this purchase
  • email (str) – Customer’s email address
  • product_id (int) – ID of the product associated with this sale

:param SQLAlchemy.relationship product: The associated product :param downloads_left int: Number of downloads remaining using this URL

downloads_left
email
product
product_id
sell_date()
sold_at
uuid
class bull.models.User(**kwargs)

Bases: flask_sqlalchemy.Model

An admin user capable of viewing reports.

Parameters:
  • email (str) – email address of user
  • password (str) – encrypted password for the user
authenticated
email
get_id()

Return the email address to satify Flask-Login’s requirements.

is_active()

True, as all users are active.

is_anonymous()

False, as anonymous users aren’t supported.

is_authenticated()

Return True if the user is authenticated.

password

Module contents

Bull library, used for selling digital goods.

Table Of Contents

This Page