<commit_before>from flask import *
import requests
import json
import transactions
import hashlib
import addresses

app = Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS']=True

@app.route('/', methods=['GET'])
def home():
    responsejson = {}
    responsejson['message']="AssemblyCoins V2"

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/colors/issue', methods=['POST'])   #WORKS
def givenewaddress_specifics():
    jsoninput=json.loads(request.data)

    public_address=str(jsoninput['public_address'])
    private_key=str(jsoninput['private_key'])

    coin_name=str(jsoninput['name'])
    color_amount=str(jsoninput['coins'])
    dest_address=public_address

    #shortened = transactions.make_url_shortened(public_address, 8)
    metadata = ""#"https://coins.assembly.com/colors/"+str(shortened)
    transactions.queue_issuing_tx(public_address, dest_address, private_key, metadata, color_amount)
    tosend = transactions.default_fee * 0.00000001

    responsejson={}
    responsejson['name']=coin_name
    responsejson['minting_fee']=tosend
    responsejson['issuing_public_address']=public_address
    responsejson['issuing_private_key']=private_key

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/colors/transfer', methods=['POST'])
def transfer():
    jsoninput=json.loads(request.data)
    sender_public = str(jsoninput['public_address'])
    sender_private = str(jsoninput['private_key'])
    recipient_public = str(jsoninput['recipient_address'])
    amount = str(jsoninput['amount'])
    metadata = ""
    asset_address = str(jsoninput['asset_address'])

    transactions.queue_transfer_tx(sender_public, sender_private, recipient_public, amount, metadata, asset_address)

    responsejson={}
    responsejson['message'] = "Color Transaction Queued"

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/btc/transfer', methods = ['POST'])
def send_btc():
    jsoninput = json.loads(request.data)
    sender_public = str(jsoninput['public_address'])
    sender_private = str(jsoninput['private_key'])
    recipient_public = str(jsoninput['recipient_address'])
    amount = str(jsoninput['amount'])
    print str(sender_public)+"  "+str(sender_private)+"  "+str(recipient_public)+"   "+str(amount)
    transactions.queue_btc_tx(sender_public, sender_private, recipient_public, amount)

    responsejson={}
    responsejson['message'] = "BTC Transaction Queued"

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/addresses/')
def new_address():
    responsejson={}
    a = addresses.random_address_pair()
    responsejson['private_key'] = a[0]
    responsejson['public_key'] = a[1]
    responsekson['public_address'] = a[2]
    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response



if __name__ == '__main__':
    app.run()<commit_msg>fixed dependency<commit_after>from flask import *
import requests
import json
import transactions
import hashlib
import addresses

app = Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS']=True

@app.route('/', methods=['GET'])
def home():
    responsejson = {}
    responsejson['message']="AssemblyCoins V2"

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/colors/issue', methods=['POST'])   #WORKS
def givenewaddress_specifics():
    jsoninput=json.loads(request.data)

    public_address=str(jsoninput['public_address'])
    private_key=str(jsoninput['private_key'])

    coin_name=str(jsoninput['name'])
    color_amount=str(jsoninput['coins'])
    dest_address=public_address

    #shortened = transactions.make_url_shortened(public_address, 8)
    metadata = ""#"https://coins.assembly.com/colors/"+str(shortened)
    transactions.queue_issuing_tx(public_address, dest_address, private_key, metadata, color_amount)
    tosend = transactions.default_fee * 0.00000001

    responsejson={}
    responsejson['name']=coin_name
    responsejson['minting_fee']=tosend
    responsejson['issuing_public_address']=public_address
    responsejson['issuing_private_key']=private_key

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/colors/transfer', methods=['POST'])
def transfer():
    jsoninput=json.loads(request.data)
    sender_public = str(jsoninput['public_address'])
    sender_private = str(jsoninput['private_key'])
    recipient_public = str(jsoninput['recipient_address'])
    amount = str(jsoninput['amount'])
    metadata = ""
    asset_address = str(jsoninput['asset_address'])

    transactions.queue_transfer_tx(sender_public, sender_private, recipient_public, amount, metadata, asset_address)

    responsejson={}
    responsejson['message'] = "Color Transaction Queued"

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/btc/transfer', methods = ['POST'])
def send_btc():
    jsoninput = json.loads(request.data)
    sender_public = str(jsoninput['public_address'])
    sender_private = str(jsoninput['private_key'])
    recipient_public = str(jsoninput['recipient_address'])
    amount = str(jsoninput['amount'])
    print str(sender_public)+"  "+str(sender_private)+"  "+str(recipient_public)+"   "+str(amount)
    transactions.queue_btc_tx(sender_public, sender_private, recipient_public, amount)

    responsejson={}
    responsejson['message'] = "BTC Transaction Queued"

    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response

@app.route('/v2/addresses/')
def new_address():
    responsejson={}
    a = addresses.random_address_pair()
    responsejson['private_key'] = a[0]
    responsejson['public_key'] = a[1]
    responsejson['public_address'] = a[2]
    responsejson=json.dumps(responsejson)
    response=make_response(responsejson, 200)
    response.headers['Content-Type'] = 'application/json'
    response.headers['Access-Control-Allow-Origin']= '*'
    return response



if __name__ == '__main__':
    app.run()
{'fraction_non_alphanumeric': 0.13914934094306292, 'fraction_numerical': 0.008968609865470852, 'mean_word_length': 5.4, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6006734', 'n_tokens_mistral': 2307, 'n_tokens_neox': 2226, 'n_words': 328}