<commit_before>import os
import glob
import re
from flask import Flask, request, jsonify, abort, json
import psycopg2, psycopg2.extras
import msc_apps

sqlconn = msc_apps.sql_connect()
data_dir_root = os.environ.get('DATADIR')

app = Flask(__name__)
app.debug = True

#TODO COnversion
@app.route('/properties')
def properties():
  prop_glob = glob.glob(data_dir_root + '/properties/*.json')

  response = []
  for property_file in prop_glob:
    with open(property_file, 'r') as f:
      prop = json.load(f)[0]
      response.append({ 'currencyID': prop['currencyId'], 'name': prop['propertyName'] })

  json_response = json.dumps( sorted(response, key=lambda x:  int(x['currencyID']) ))
  return json_response

@app.route('/addresses')
def addresses():
  currency_id = request.args.get('currency_id')
  response = []
<commit_msg>Add SP query, mastercoin_Verify endpoint<commit_after>import os
import glob
import re
from flask import Flask, request, jsonify, abort, json
import psycopg2, psycopg2.extras
import msc_apps

sqlconn = msc_apps.sql_connect()
data_dir_root = os.environ.get('DATADIR')

app = Flask(__name__)
app.debug = True

#TODO COnversion
@app.route('/properties')
def properties():
  sqlconn.execute("select * from smartproperties")
  ROWS= sqlconn.fetchall()

  def dehexify(hex_str):
      temp_str=[]
      for let in hex_str:
          if ord(let) < 128:
              temp_str.append(let)
          else:
              temp_str.append('?')
      return ''.join(temp_str)

  response = []
  for sprow in ROWS:
      print sprow
      res = {
          'currencyID': sprow[1],
          'name': dehexify(sprow[6]) 
      }
      response.append(res)

  json_response = json.dumps( sorted(response, key=lambda x:  int(x['currencyID']) ))
  return json_response

@app.route('/addresses')
def addresses():
  currency_id = request.args.get('currency_id')
  response = []

{'fraction_non_alphanumeric': 0.1320254506892895, 'fraction_numerical': 0.005302226935312832, 'mean_word_length': 3.8260869565217392, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '83909', 'n_tokens_mistral': 641, 'n_tokens_neox': 632, 'n_words': 149}