Skip to content

Commit

Permalink
fix: decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul Castro committed Apr 18, 2024
1 parent b24ec03 commit a68b022
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from flask import Flask, request, jsonify
from flask_cors import CORS, cors_origin
from flask_cors import CORS, cross_origin
from controllers import mainprices

api = Flask(__name__)
cors=CORS(api)
api.config['CORS_HEADERS'] = 'Content-Type'
@api.route('/')
@cors_origin()
@cross_origin()
def get_generic():
return {
'/ticker/fundamentals/TICKER.sa':'Fundamentals (quarterly)',
Expand All @@ -15,23 +15,23 @@ def get_generic():
}, 200

@api.route('/ticker/<string:name>')
@cors_origin()
@cross_origin()
def get_show(name):
result = mainprices.ShowMarket.show_ticker(name)
if result:
return result, 200
return {'message':'not found'}, 404

@api.route('/ticker/fundamentals/<string:name>')
@cors_origin()
@cross_origin()
def get_fundamentals_show(name):
result = mainprices.ShowMarket.fundamentals_ticker(name)
if result:
return result, 200
return {'message':'not found'}, 404

@api.route('/ticker/cashflow/<string:name>')
@cors_origin()
@cross_origin()
def get_cashflow_show(name):
result = mainprices.ShowMarket.cashflow_ticker(name)
if result:
Expand Down

0 comments on commit a68b022

Please sign in to comment.