Commit 419a48ac authored by tleb's avatar tleb

/pedagogy/uv/create put urls in settings

parent 6fce2711
Pipeline #2116 failed with stage
in 49 minutes and 15 seconds
......@@ -2,6 +2,7 @@ from rest_framework.response import Response
from rest_framework.decorators import api_view, renderer_classes
from rest_framework.renderers import JSONRenderer
from django.core.exceptions import PermissionDenied
from django.conf import settings
from rest_framework import serializers
import urllib.request
import json
......@@ -34,7 +35,7 @@ def find_uv(lang, year, code):
full_uv is the detailed representation of an UV.
"""
# query the UV list
uvs_url = "https://extranet1.utbm.fr/gpedago/api/guide/uvs/{lang}/{year}"
uvs_url = settings.SITH_PEDAGOGY_UTBM_API_UVS_URL
response = urllib.request.urlopen(uvs_url.format(lang=lang, year=year))
uvs = json.loads(response.read().decode("utf-8"))
......@@ -45,9 +46,8 @@ def find_uv(lang, year, code):
return (None, None)
# get detailed information about the UV
uv_url = "https://extranet1.utbm.fr/gpedago/api/guide/uv/{lang}/{year}/{code}/{formation}"
response = urllib.request.urlopen(
uv_url.format(
settings.SITH_PEDAGOGY_UTBM_API_UV_URL.format(
lang=lang, year=year, code=code, formation=short_uv["codeFormation"]
)
)
......
......@@ -445,6 +445,9 @@ SITH_PEDAGOGY_UV_RESULT_GRADE = [
("ABS", _("Abs")),
]
SITH_PEDAGOGY_UTBM_API_UVS_URL = "https://extranet1.utbm.fr/gpedago/api/guide/uvs/{lang}/{year}"
SITH_PEDAGOGY_UTBM_API_UV_URL = "https://extranet1.utbm.fr/gpedago/api/guide/uv/{lang}/{year}/{code}/{formation}"
SITH_ECOCUP_CONS = 1152
SITH_ECOCUP_DECO = 1151
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment