Created
July 30, 2016 00:32
-
-
Save cponeill/2aa19a93d6749df609a31220d91a87c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import sys | |
import json | |
import random | |
import subprocess | |
from flask import Flask | |
from flask import request | |
from flask import send_from_directory | |
from two1.wallet import Wallet | |
from two1.bitserv.flask import Payment | |
app = Flask(__name__) | |
wallet = Wallet() | |
payment = Payment(app, wallet) | |
# machine-payable endpoint that returns fortune if payment made | |
@app.route('/buy') | |
@payment.required(1000) | |
def buy_fortune(): | |
fortune = subprocess.check_output(["fortune"]) | |
return fortune | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment