-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviews.py
23 lines (22 loc) · 846 Bytes
/
views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django.shortcuts import render
import requests
def cotizacion(request):
oficial = requests.get('https://api-dolar-argentina.herokuapp.com/api/dolaroficial')
blue = requests.get('https://api-dolar-argentina.herokuapp.com/api/dolarblue')
liqui = requests.get('https://api-dolar-argentina.herokuapp.com/api/contadoliqui')
turista = requests.get('https://api-dolar-argentina.herokuapp.com/api/dolarturista')
bolsa = requests.get('https://api-dolar-argentina.herokuapp.com/api/dolarbolsa')
r1 = oficial.json()
r2 = blue.json()
r3 = liqui.json()
r4 = turista.json()
r5 = bolsa.json()
resultados = {
"oficial":r1,
"blue":r2,
"liqui":r3,
"turista":r4,
"bolsa":r5
}
context = {'cotizacion':resultados}
return render(request, "dolar/dolar.html",context)