Skip to content

Commit

Permalink
Return MAX_FEE_VALUE if no http sources available;
Browse files Browse the repository at this point in the history
  • Loading branch information
k-karuna committed Dec 17, 2023
1 parent 6a7b9d6 commit 09467c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

app = Flask(__name__)

MAX_FEE_VALUE = 1500


@app.route('/getbitcoinfees')
def main_route():
Expand Down Expand Up @@ -43,7 +45,7 @@ def main_route():
else:
data = int(data)

if 1 <= data <= 1500:
if 1 <= data <= MAX_FEE_VALUE:
data = {
'fastestFee': data,
'halfHourFee': data,
Expand All @@ -56,8 +58,13 @@ def main_route():

except Exception as e:
print(e)

try:
r = requests.get(url='https://bitcoinfees.earn.com/api/v1/fees/recommended')
return r.json()
except Exception as e:
print(e)
return {"fastestFee": MAX_FEE_VALUE, "halfHourFee": MAX_FEE_VALUE, "hourFee": MAX_FEE_VALUE}


def remove_html_entities(json_string):
Expand Down

0 comments on commit 09467c5

Please sign in to comment.