se utiliza variables de ambientes
parent
798221981a
commit
bf8ff14fd1
|
@ -1,15 +1,16 @@
|
|||
from django.shortcuts import render
|
||||
from django.http import JsonResponse
|
||||
from os import environ
|
||||
import requests
|
||||
|
||||
# app/views.py
|
||||
|
||||
|
||||
def get_auth_token():
|
||||
auth_url = "https://transporte.hz.kursor.cl/api/auth/"
|
||||
auth_url = f'{environ["TRANSPORTE_API"]}/auth/'
|
||||
auth_data = {
|
||||
"username": "usuario1",
|
||||
"password": "usuario1"
|
||||
"username": environ["TRANSPORTE_USER"],
|
||||
"password": environ["TRANSPORTE_PASS"]
|
||||
}
|
||||
response = requests.post(auth_url, json=auth_data)
|
||||
|
||||
|
@ -26,7 +27,7 @@ def paradero_info(request):
|
|||
token = get_auth_token()
|
||||
|
||||
# Realiza una solicitud a la API GetInfoDevice para obtener la información
|
||||
api_url = "https://transporte.hz.kursor.cl/api/dispositivos/getInfoDevice/"
|
||||
api_url = f'{environ["TRANSPORTE_API"]}/dispositivos/getInfoDevice/'
|
||||
headers = {
|
||||
'Authorization': f'Bearer {token}'
|
||||
}
|
||||
|
|
|
@ -119,7 +119,8 @@ USE_TZ = True
|
|||
# https://docs.djangoproject.com/en/4.2/howto/static-files/
|
||||
|
||||
CORS_ALLOWED_ORIGINS = [
|
||||
"http://localhost:3000",
|
||||
"http://localhost:3001",
|
||||
"https://transporte-paradero.hz.kursor",
|
||||
# Agrega otros dominios permitidos aquí si es necesario
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue