예제 #1
0
# import flask web microframework
from flask import Flask
from flask import request
from flask import abort

# import from the 21 Developer Library
from two1.lib.bitcoin.txn import Transaction
from two1.lib.bitcoin.crypto import PublicKey
from two1.lib.wallet import Wallet, exceptions
from two1.lib.bitserv.flask import Payment

USCENT = 2801

pp = pprint.PrettyPrinter(indent=2)

db = srvdb.SrvDb('turk.db')

app = Flask(__name__)
wallet = Wallet()
payment = Payment(app, wallet)


def check_timestamp(tstamp):
    curtime = int(time.time())
    min_time = min(tstamp, curtime)
    max_time = max(tstamp, curtime)
    time_diff = max_time - min_time
    if (time_diff > 15):
        return False
    return True
예제 #2
0
# import flask web microframework
from flask import Flask
from flask import request
from flask import abort

# import from the 21 Developer Library
from two1.lib.bitcoin.txn import Transaction
from two1.lib.bitcoin.crypto import PublicKey
from two1.lib.wallet import Wallet, exceptions
from two1.lib.bitserv.flask import Payment

USCENT=2801

pp = pprint.PrettyPrinter(indent=2)

db = srvdb.SrvDb('dns.db')

app = Flask(__name__)
wallet = Wallet()
payment = Payment(app, wallet)

name_re = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9-]*$")

def valid_name(name):
    if not name or len(name) < 1 or len(name) > 64:
        return False
    if not name_re.match(name):
        return False
    return True

@app.route('/domains')
예제 #3
0
from two1.lib.bitcoin.txn import Transaction
from two1.lib.bitcoin.crypto import PublicKey
from two1.lib.wallet import Wallet, exceptions
from two1.lib.bitserv.flask import Payment

server_config = json.load(open("dns-server.conf"))

USCENT = 2824
DNS_SERVER1 = server_config["DNS_SERVER1"]
NSUPDATE_KEYFILE = server_config["NSUPDATE_KEYFILE"]
NSUPDATE_LOG = server_config["NSUPDATE_LOG"]
nsupdate_logging = server_config["NSUPDATE_LOGGING"]

pp = pprint.PrettyPrinter(indent=2)

db = srvdb.SrvDb(server_config["DB_PATHNAME"])

app = Flask(__name__)
wallet = Wallet()
payment = Payment(app, wallet)

name_re = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9-]*$")
name_ns_re = re.compile(r"^ns[0-9]+")


def valid_name(name):
    if not name or len(name) < 1 or len(name) > 64:
        return False
    if not name_re.match(name):
        return False
    return True
예제 #4
0
wallet = Wallet()
username = Config().username
requests = BitTransferRequests(wallet, username)

app = Flask(__name__)
# app.debug = True

# setup wallet
wallet = Wallet()
payment = Payment(app, wallet)

# logging
logger = logging.getLogger('werkzeug')

# db handle
db = srvdb.SrvDb("./ping-aggregator.db")


@app.route('/manifest')
def manifest():
    """Provide the app manifest to the 21 crawler.
    """
    with open('./manifest.yaml', 'r') as f:
        manifest = yaml.load(f)
    return json.dumps(manifest)


def get_payment_amt(request):
    """
    Return the amount of the request based on the number of nodes.
    """