Last active
July 30, 2016 00:50
-
-
Save fredzannarbor/b6613b7175b9b8b6a08ef22f4a679b0c to your computer and use it in GitHub Desktop.
baby server
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 subprocess | |
from flask import Flask | |
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"]) | |
print(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