Flask-Coin is an extension to Flask that adds Bitcoin and Altcoin support to any Flask application with the help of bitcoin-python.
Install the extension with one of the following commands:
$ easy_install Flask-Coin
or alternatively if you have pip installed:
$ pip install Flask-Coin
To get started all you need to do is to instanciate a Coin object after configuring the application:
from flask import Flask
from flask.ext.coin import Coin, coin
app = Flask(__name__)
app.config.from_pyfile('mysettings.cfg')
c = Coin(app)
@app.route('/')
def main():
return coin.getaccountaddress('')
The coin variable imported from flask.ext.coin always uses the connection bound to the current Flask application context.
Coin has one configuration value that can be used to change some internal defaults:
COIN_RPC_URL | The default URL to use for communicating with bitcoind. This can be an https, http or file URL and defaults to 'file:///tmp/bitcoin.conf'. |
This part of the documentation documents each and every public class or function from Flask-Coin.
Central controller class that can be used to configure how Flask-Coin behaves. Each application that wants to use Flask-Coin has to create, or run init_app() on, an instance of this class after the configuration was initialized.
Set up this instance for use with app, if no app was passed to the constructor.
Coin logo used above from “A Dictionary of Roman Coins”, Stevenson, Smith and Madden, 1889.