Skip to content

Commit

Permalink
Update response for /v1/plans to include keys in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
freQniK committed Nov 28, 2023
1 parent f71de00 commit 5c209af
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions meile_plan_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,17 @@ def get_plan_subscriptions():
c = GetDBCursor()
c.execute(query)

rows = c.fetchall()
columns = [desc[0] for desc in c.description]
result = []
for row in rows:
row = dict(zip(columns, row))
result.append(row)

try:
return Response(jsonify(data=c.fetchall()), status=200, mimetype='application/json')
except:
return jsonify(result)
except Exception as e:
print(str(e))
abort(404)

@app.route('/v1/subscription/<walletAddress>', methods=['GET'])
Expand Down

0 comments on commit 5c209af

Please sign in to comment.