|
@ -189,9 +189,7 @@ def api_args(): |
|
|
api_phrase.append(random.choice(toChooseFrom[testKey])) |
|
|
api_phrase.append(random.choice(toChooseFrom[testKey])) |
|
|
api_phrase[0] = api_phrase[0].capitalize() |
|
|
api_phrase[0] = api_phrase[0].capitalize() |
|
|
api_phrase_str_word = ' '.join(api_phrase) |
|
|
api_phrase_str_word = ' '.join(api_phrase) |
|
|
print('api_phrase_str_word: ',api_phrase_str_word) |
|
|
|
|
|
api_phrase_str = api_phrase_str + '\\n' + api_phrase_str_word |
|
|
api_phrase_str = api_phrase_str + '\\n' + api_phrase_str_word |
|
|
print('api_phrase_str: ',api_phrase_str) |
|
|
|
|
|
api_phrase_str_word = '' |
|
|
api_phrase_str_word = '' |
|
|
api_phrase_str = api_phrase_str[2:] |
|
|
api_phrase_str = api_phrase_str[2:] |
|
|
|
|
|
|
|
@ -239,10 +237,20 @@ def api_args(): |
|
|
refusal_message = build_error_two() |
|
|
refusal_message = build_error_two() |
|
|
org = 'someone' |
|
|
org = 'someone' |
|
|
request_type = 'unknown request' |
|
|
request_type = 'unknown request' |
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
out = counter.value |
|
|
with counter.get_lock(): |
|
|
if out < 10: |
|
|
counter.value += 1 |
|
|
with counter.get_lock(): |
|
|
return jsonify(refusal_message) |
|
|
counter.value += 1 |
|
|
|
|
|
out = counter.value |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
else: |
|
|
|
|
|
with counter.get_lock(): |
|
|
|
|
|
counter.value = 0 |
|
|
|
|
|
refusal_code = 402 |
|
|
|
|
|
refusal_message = build_error_three() |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.errorhandler(400) |
|
|
@app.errorhandler(400) |
|
@ -253,10 +261,19 @@ def error_fourzerozero(e): |
|
|
refusal_message = build_error_two() |
|
|
refusal_message = build_error_two() |
|
|
org = 'someone' |
|
|
org = 'someone' |
|
|
request_type = 'unknown request' |
|
|
request_type = 'unknown request' |
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
out = counter.value |
|
|
with counter.get_lock(): |
|
|
if out < 10: |
|
|
counter.value += 1 |
|
|
with counter.get_lock(): |
|
|
return jsonify(refusal_message) |
|
|
counter.value += 1 |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
else: |
|
|
|
|
|
with counter.get_lock(): |
|
|
|
|
|
counter.value = 0 |
|
|
|
|
|
refusal_code = 402 |
|
|
|
|
|
refusal_message = build_error_three() |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
|
|
|
@app.errorhandler(404) |
|
|
@app.errorhandler(404) |
|
|
def error_fourzerofour(e): |
|
|
def error_fourzerofour(e): |
|
@ -266,10 +283,19 @@ def error_fourzerofour(e): |
|
|
refusal_message = build_error_two() |
|
|
refusal_message = build_error_two() |
|
|
org = 'someone' |
|
|
org = 'someone' |
|
|
request_type = 'unknown request' |
|
|
request_type = 'unknown request' |
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
out = counter.value |
|
|
with counter.get_lock(): |
|
|
if out < 10: |
|
|
counter.value += 1 |
|
|
with counter.get_lock(): |
|
|
return jsonify(refusal_message) |
|
|
counter.value += 1 |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
else: |
|
|
|
|
|
with counter.get_lock(): |
|
|
|
|
|
counter.value = 0 |
|
|
|
|
|
refusal_code = 402 |
|
|
|
|
|
refusal_message = build_error_three() |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
|
|
|
@app.errorhandler(500) |
|
|
@app.errorhandler(500) |
|
|
def error_fivezerozero(e): |
|
|
def error_fivezerozero(e): |
|
@ -279,9 +305,18 @@ def error_fivezerozero(e): |
|
|
refusal_message = build_error_two() |
|
|
refusal_message = build_error_two() |
|
|
org = 'someone' |
|
|
org = 'someone' |
|
|
request_type = 'unknown request' |
|
|
request_type = 'unknown request' |
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message ) |
|
|
out = counter.value |
|
|
with counter.get_lock(): |
|
|
if out < 10: |
|
|
counter.value += 1 |
|
|
with counter.get_lock(): |
|
|
return jsonify(refusal_message) |
|
|
counter.value += 1 |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
else: |
|
|
|
|
|
with counter.get_lock(): |
|
|
|
|
|
counter.value = 0 |
|
|
|
|
|
refusal_code = 402 |
|
|
|
|
|
refusal_message = build_error_three() |
|
|
|
|
|
add_error_db(timestamp,org,seedText,request_type,refusal_code,refusal_message) |
|
|
|
|
|
return jsonify(refusal_message) |
|
|
|
|
|
|
|
|
# app.run() |
|
|
# app.run() |
|
|