Python with Flask
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
backend/python/crypto/__pycache__/coingecko.cpython-39.pyc
Normal file
BIN
backend/python/crypto/__pycache__/coingecko.cpython-39.pyc
Normal file
Binary file not shown.
BIN
backend/python/crypto/__pycache__/index.cpython-39.pyc
Normal file
BIN
backend/python/crypto/__pycache__/index.cpython-39.pyc
Normal file
Binary file not shown.
BIN
backend/python/crypto/__pycache__/miindicador.cpython-39.pyc
Normal file
BIN
backend/python/crypto/__pycache__/miindicador.cpython-39.pyc
Normal file
Binary file not shown.
50
backend/python/crypto/index.py
Normal file
50
backend/python/crypto/index.py
Normal file
@ -0,0 +1,50 @@
|
||||
from flask import Flask
|
||||
|
||||
from crypto.coingecko import CoinGecko
|
||||
from crypto.miindicador import MiIndicador
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def main():
|
||||
output = [
|
||||
"<html>",
|
||||
"<body>",
|
||||
"Welcome",
|
||||
"</body>",
|
||||
"</html>"
|
||||
]
|
||||
return "\n".join(output)
|
||||
|
||||
|
||||
@app.route('/crypto/historical/<ids>/<from_>/<to>')
|
||||
@app.route('/crypto/historical/<ids>/<from_>/<to>/<currencies>')
|
||||
def historical_crypto(ids, from_, to, currencies='usd'):
|
||||
cg = CoinGecko()
|
||||
return cg.historical(id_=ids, from_=from_, to=to, currency=currencies)
|
||||
|
||||
|
||||
@app.route('/crypto/<ids>')
|
||||
@app.route('/crypto/<ids>/<currencies>')
|
||||
def crypto(ids, currencies=('usd', 'clp')):
|
||||
cg = CoinGecko()
|
||||
return cg.get(ids, currencies)
|
||||
|
||||
|
||||
@app.route('/indicador/historical/<ind>')
|
||||
@app.route('/indicador/historical/<ind>/<since>')
|
||||
def historical_indicador(ind, since=None):
|
||||
mi = MiIndicador()
|
||||
return mi.historical(ind, since)
|
||||
|
||||
|
||||
@app.route('/indicador/<ind>')
|
||||
@app.route('/indicador/<ind>/<fecha>')
|
||||
def indicador(ind, fecha=None):
|
||||
mi = MiIndicador()
|
||||
return mi.get(ind, fecha)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5001, debug=True)
|
@ -1,10 +0,0 @@
|
||||
name: cryptos
|
||||
channels:
|
||||
- defaults
|
||||
dependencies:
|
||||
- httpx=0.17.1
|
||||
- pip=21.1.2
|
||||
- python=3.9.5
|
||||
- setuptools=52.0.0
|
||||
# - pip:
|
||||
# - pyinstaller==4.3
|
@ -1,30 +0,0 @@
|
||||
# This file may be used to create an environment using:
|
||||
# $ conda create --name <env> --file <this file>
|
||||
# platform: win-64
|
||||
altgraph=0.17=pypi_0
|
||||
ca-certificates=2021.5.25=haa95532_1
|
||||
certifi=2021.5.30=py39haa95532_0
|
||||
future=0.18.2=pypi_0
|
||||
h11=0.12.0=pyhd3eb1b0_0
|
||||
h2=4.0.0=py39haa95532_3
|
||||
hpack=4.0.0=py_0
|
||||
httpcore=0.12.3=pyhd3eb1b0_0
|
||||
httpx=0.17.1=pyhd3eb1b0_0
|
||||
hyperframe=6.0.1=pyhd3eb1b0_0
|
||||
idna=2.10=pyhd3eb1b0_0
|
||||
openssl=1.1.1k=h2bbff1b_0
|
||||
pefile=2021.5.24=pypi_0
|
||||
pip=21.1.2=py39haa95532_0
|
||||
pyinstaller=4.3=pypi_0
|
||||
pyinstaller-hooks-contrib=2021.1=pypi_0
|
||||
python=3.9.5=h6244533_3
|
||||
pywin32-ctypes=0.2.0=pypi_0
|
||||
rfc3986=1.4.0=py_0
|
||||
setuptools=52.0.0=py39haa95532_0
|
||||
sniffio=1.2.0=py39haa95532_1
|
||||
sqlite=3.35.4=h2bbff1b_0
|
||||
tzdata=2020f=h52ac0ba_0
|
||||
vc=14.2=h21ff451_1
|
||||
vs2015_runtime=14.27.29016=h5e58377_2
|
||||
wheel=0.36.2=pyhd3eb1b0_0
|
||||
wincertstore=0.2=py39h2bbff1b_0
|
Reference in New Issue
Block a user