ladok3 4.17__py3-none-any.whl → 4.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ladok3 might be problematic. Click here for more details.
- doc/ltxobj/ladok3.pdf +0 -0
- ladok3/__init__.py +619 -3130
- ladok3/api.nw +1001 -10
- ladok3/ladok3.nw +70 -4
- ladok3/report.nw +124 -117
- ladok3/report.py +81 -63
- ladok3/student.nw +20 -1
- ladok3/student.py +62 -41
- ladok3/undoc.nw +54 -3111
- {ladok3-4.17.dist-info → ladok3-4.19.dist-info}/LICENSE +1 -1
- {ladok3-4.17.dist-info → ladok3-4.19.dist-info}/METADATA +28 -1
- ladok3-4.19.dist-info/RECORD +21 -0
- ladok3-4.17.dist-info/RECORD +0 -21
- {ladok3-4.17.dist-info → ladok3-4.19.dist-info}/WHEEL +0 -0
- {ladok3-4.17.dist-info → ladok3-4.19.dist-info}/entry_points.txt +0 -0
ladok3/api.nw
CHANGED
|
@@ -16,13 +16,11 @@ We will use the following to test the API methods.
|
|
|
16
16
|
<<test api.py>>=
|
|
17
17
|
import json
|
|
18
18
|
import ladok3
|
|
19
|
+
import ladok3.cli
|
|
19
20
|
import os
|
|
20
21
|
|
|
21
|
-
ladok = ladok3.LadokSession(
|
|
22
|
-
|
|
23
|
-
vars={"username": os.environ["LADOK_USER"],
|
|
24
|
-
"password": os.environ["LADOK_PASS"]},
|
|
25
|
-
test_environment=True) # for experiments
|
|
22
|
+
ladok = ladok3.LadokSession(*ladok3.cli.load_credentials(),
|
|
23
|
+
test_environment=True) # for experiments
|
|
26
24
|
|
|
27
25
|
student_uid = "de709f81-a867-11e7-8dbf-78e86dc2470c"
|
|
28
26
|
dasak_instance_id = "39c56d6a-73d8-11e8-b4e0-063f9afb40e3"
|
|
@@ -41,13 +39,11 @@ This is useful for development and when LADOK changes anything in the API.
|
|
|
41
39
|
\begin{pycode}[apitest]
|
|
42
40
|
import json
|
|
43
41
|
import ladok3
|
|
42
|
+
import ladok3.cli
|
|
44
43
|
import os
|
|
45
44
|
|
|
46
|
-
ladok = ladok3.LadokSession(
|
|
47
|
-
|
|
48
|
-
vars={"username": os.environ["LADOK_USER"],
|
|
49
|
-
"password": os.environ["LADOK_PASS"]},
|
|
50
|
-
test_environment=True) # for experiments
|
|
45
|
+
ladok = ladok3.LadokSession(*ladok3.cli.load_credentials(),
|
|
46
|
+
test_environment=True) # for experiments
|
|
51
47
|
|
|
52
48
|
student_uid = "de709f81-a867-11e7-8dbf-78e86dc2470c"
|
|
53
49
|
dasak_instance_id = "39c56d6a-73d8-11e8-b4e0-063f9afb40e3"
|
|
@@ -534,6 +530,43 @@ print(r"\end{minted}")
|
|
|
534
530
|
\end{pycode}
|
|
535
531
|
|
|
536
532
|
|
|
533
|
+
\section{[[studystructure_student_JSON]]}
|
|
534
|
+
|
|
535
|
+
We also want to get a student's study structure, that is programmes that they
|
|
536
|
+
are admitted to.
|
|
537
|
+
<<LadokSession data methods>>=
|
|
538
|
+
# added by GQMJr
|
|
539
|
+
def studystructure_student_JSON(self, uid):
|
|
540
|
+
"""
|
|
541
|
+
Returns a dictionary of student information. This contains programmes that
|
|
542
|
+
the student is admitted to.
|
|
543
|
+
"""
|
|
544
|
+
r = self.session.get(
|
|
545
|
+
url=self.base_gui_proxy_url +
|
|
546
|
+
'/studiedeltagande/internal/studiestruktur/student/'+uid,
|
|
547
|
+
headers=self.headers)
|
|
548
|
+
if r.status_code == 200:
|
|
549
|
+
return r.json()
|
|
550
|
+
return None
|
|
551
|
+
@
|
|
552
|
+
|
|
553
|
+
Let's add a test.
|
|
554
|
+
This should return a dictionary.
|
|
555
|
+
<<test functions>>=
|
|
556
|
+
def test_studystructure_student_JSON():
|
|
557
|
+
r = ladok.studystructure_student_JSON(student_uid)
|
|
558
|
+
assert type(r) == dict
|
|
559
|
+
@
|
|
560
|
+
|
|
561
|
+
The output looks like this:
|
|
562
|
+
\begin{pycode}[apitest]
|
|
563
|
+
print(r"\begin{minted}{JSON}")
|
|
564
|
+
print(json.dumps(ladok3.clean_data(ladok.studystructure_student_JSON(student_uid)),
|
|
565
|
+
indent=2))
|
|
566
|
+
print(r"\end{minted}")
|
|
567
|
+
\end{pycode}
|
|
568
|
+
|
|
569
|
+
|
|
537
570
|
|
|
538
571
|
\chapter{Course-related API calls}
|
|
539
572
|
|
|
@@ -649,6 +682,130 @@ print(r"\end{minted}")
|
|
|
649
682
|
\end{pycode}
|
|
650
683
|
|
|
651
684
|
|
|
685
|
+
\section{[[course_instances_JSON]]}
|
|
686
|
+
|
|
687
|
+
We can get a list of course instances for a given course code.
|
|
688
|
+
<<LadokSession data methods>>=
|
|
689
|
+
# added by GQMJr
|
|
690
|
+
def course_instances_JSON(self, course_code, lang = 'sv'):
|
|
691
|
+
"""
|
|
692
|
+
Returns a list of dictionaries with course instances for a given course code.
|
|
693
|
+
The course code is a string such as "DD1310". The language code is 'en' or
|
|
694
|
+
'sv'.
|
|
695
|
+
|
|
696
|
+
Note that there seems to be a limit of 403 for the number of pages.
|
|
697
|
+
"""
|
|
698
|
+
r = self.session.get(
|
|
699
|
+
url=self.base_gui_proxy_url + '/resultat/internal/kurstillfalle/filtrera?kurskod=' +
|
|
700
|
+
course_code + '&page=1&limit=100&skipCount=false&sprakkod=' + lang, # not sure about this one /CO
|
|
701
|
+
headers=self.headers).json()
|
|
702
|
+
return r
|
|
703
|
+
@
|
|
704
|
+
|
|
705
|
+
Let's add a test.
|
|
706
|
+
This should return a list of dictionaries.
|
|
707
|
+
<<test functions>>=
|
|
708
|
+
def test_course_instances_JSON():
|
|
709
|
+
r = ladok.course_instances_JSON('DD2395')
|
|
710
|
+
assert type(r) == dict
|
|
711
|
+
@
|
|
712
|
+
|
|
713
|
+
The output looks like this:
|
|
714
|
+
\begin{pycode}[apitest]
|
|
715
|
+
print(r"\begin{minted}{JSON}")
|
|
716
|
+
print(json.dumps(ladok3.clean_data(ladok.course_instances_JSON('DD2395')),
|
|
717
|
+
indent=2))
|
|
718
|
+
print(r"\end{minted}")
|
|
719
|
+
\end{pycode}
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
\section{[[instance_info]]}
|
|
723
|
+
|
|
724
|
+
This function gets a course instance by the combination of course code (\eg
|
|
725
|
+
DD1310) and the five digit round code (\eg 50429).
|
|
726
|
+
<<LadokSession data methods>>=
|
|
727
|
+
# added by GQMJr
|
|
728
|
+
def instance_info(self, course_code, instance_code, lang = 'sv'):
|
|
729
|
+
"""
|
|
730
|
+
Returns a dictionary of course instance information.
|
|
731
|
+
|
|
732
|
+
course_code - course code, such as "DD1310"
|
|
733
|
+
|
|
734
|
+
instance_code - instance of the course ('TillfallesKod')
|
|
735
|
+
|
|
736
|
+
lang - language code 'en' or 'sv', defaults to 'sv'
|
|
737
|
+
"""
|
|
738
|
+
r = self.session.get(
|
|
739
|
+
url=self.base_gui_proxy_url +
|
|
740
|
+
'/resultat/internal/kurstillfalle/filtrera?kurskod=' + course_code +
|
|
741
|
+
'&page=1&limit=25&skipCount=false&sprakkod=' + lang,
|
|
742
|
+
headers=self.headers)
|
|
743
|
+
if r.status_code == requests.codes.ok:
|
|
744
|
+
rj=r.json()
|
|
745
|
+
for course in rj['Resultat']:
|
|
746
|
+
if course['TillfallesKod'] == instance_code:
|
|
747
|
+
return course
|
|
748
|
+
return None
|
|
749
|
+
@
|
|
750
|
+
|
|
751
|
+
Let's add a test.
|
|
752
|
+
This should return a dictionary.
|
|
753
|
+
<<test functions>>=
|
|
754
|
+
def test_instance_info():
|
|
755
|
+
r = ladok.instance_info('DD1310', '50429')
|
|
756
|
+
assert type(r) == dict
|
|
757
|
+
@
|
|
758
|
+
|
|
759
|
+
The output looks like this:
|
|
760
|
+
\begin{pycode}[apitest]
|
|
761
|
+
print(r"\begin{minted}{JSON}")
|
|
762
|
+
print(json.dumps(ladok3.clean_data(ladok.instance_info('DD1310', '50429')),
|
|
763
|
+
indent=2))
|
|
764
|
+
print(r"\end{minted}")
|
|
765
|
+
\end{pycode}
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
\section{[[instance_info_uid]]}
|
|
769
|
+
|
|
770
|
+
This function returns the same as above ([[instance_info]]) but uses the
|
|
771
|
+
course's LADOK ID.
|
|
772
|
+
This ID can be found as the [[sis_course_id]] in Canvas.
|
|
773
|
+
<<LadokSession data methods>>=
|
|
774
|
+
# added by GQMJr
|
|
775
|
+
def instance_info_uid(self, instance_uid):
|
|
776
|
+
"""
|
|
777
|
+
Returns a dictionary of course instance information.
|
|
778
|
+
|
|
779
|
+
instance_uid: course's Uid (from course_integration_id or
|
|
780
|
+
sis_course_id in Canvas)
|
|
781
|
+
"""
|
|
782
|
+
r = self.session.get(
|
|
783
|
+
url=self.base_gui_proxy_url +
|
|
784
|
+
'/resultat/internal/kurstillfalle/'+instance_uid,
|
|
785
|
+
headers=self.headers).json()
|
|
786
|
+
return r
|
|
787
|
+
@
|
|
788
|
+
|
|
789
|
+
Let's add a test.
|
|
790
|
+
This should return a dictionary.
|
|
791
|
+
<<test functions>>=
|
|
792
|
+
def test_instance_info_uid():
|
|
793
|
+
r = ladok.instance_info_uid('da99b691-8f70-11ee-b4f1-bdc8f0e04f23')
|
|
794
|
+
assert type(r) == dict
|
|
795
|
+
@
|
|
796
|
+
|
|
797
|
+
The output looks like this:
|
|
798
|
+
\begin{pycode}[apitest]
|
|
799
|
+
print(r"\begin{minted}{JSON}")
|
|
800
|
+
print(json.dumps(ladok3.clean_data(
|
|
801
|
+
ladok.instance_info_uid(dasak_instance_id)),
|
|
802
|
+
indent=2))
|
|
803
|
+
print(r"\end{minted}")
|
|
804
|
+
\end{pycode}
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
652
809
|
\section{Course components}
|
|
653
810
|
|
|
654
811
|
There are two ways to get the components for a course.
|
|
@@ -1371,3 +1528,837 @@ print(json.dumps(results, indent=2, ensure_ascii=False))
|
|
|
1371
1528
|
print(r"\end{minted}")
|
|
1372
1529
|
\end{pycode}
|
|
1373
1530
|
|
|
1531
|
+
|
|
1532
|
+
\chapter{Other API calls}
|
|
1533
|
+
|
|
1534
|
+
The following API calls were explored and written by Chip Maguire.
|
|
1535
|
+
Bosk has merely added tests and generated example output, as well as minor
|
|
1536
|
+
reformatting of the code.
|
|
1537
|
+
|
|
1538
|
+
\section{[[grading_rights]]}
|
|
1539
|
+
|
|
1540
|
+
We can get a list of our rights in LADOK.
|
|
1541
|
+
<<LadokSession data methods>>=
|
|
1542
|
+
# added by GQMJr
|
|
1543
|
+
def grading_rights(self):
|
|
1544
|
+
"""
|
|
1545
|
+
Returns a list of dictionaries with the grading rights of the logged in user.
|
|
1546
|
+
"""
|
|
1547
|
+
r = self.session.get(
|
|
1548
|
+
url=self.base_gui_proxy_url +
|
|
1549
|
+
'/resultat/internal/resultatrattighet/listaforinloggadanvandare',
|
|
1550
|
+
headers=self.headers).json()
|
|
1551
|
+
return r['Resultatrattighet']
|
|
1552
|
+
@
|
|
1553
|
+
|
|
1554
|
+
Let's add a test.
|
|
1555
|
+
This should return a list of dictionaries.
|
|
1556
|
+
<<test functions>>=
|
|
1557
|
+
def test_grading_rights():
|
|
1558
|
+
r = ladok.grading_rights()
|
|
1559
|
+
assert type(r) == list
|
|
1560
|
+
assert type(r[0]) == dict
|
|
1561
|
+
@
|
|
1562
|
+
|
|
1563
|
+
The output looks like this:
|
|
1564
|
+
\begin{pycode}[apitest]
|
|
1565
|
+
print(r"\begin{minted}{JSON}")
|
|
1566
|
+
print(json.dumps(ladok3.clean_data(ladok.grading_rights()), indent=2))
|
|
1567
|
+
print(r"\end{minted}")
|
|
1568
|
+
\end{pycode}
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
\section{[[organization_info_JSON]]}
|
|
1572
|
+
|
|
1573
|
+
We can get information about the organization.
|
|
1574
|
+
<<LadokSession data methods>>=
|
|
1575
|
+
# added by GQMJr
|
|
1576
|
+
def organization_info_JSON(self):
|
|
1577
|
+
"""
|
|
1578
|
+
Returns a dictionary of organization information for the entire institution
|
|
1579
|
+
of the logged in user.
|
|
1580
|
+
"""
|
|
1581
|
+
r = self.session.get(
|
|
1582
|
+
url=self.base_gui_proxy_url + '/resultat/internal/organisation/utanlankar',
|
|
1583
|
+
headers=self.headers).json()
|
|
1584
|
+
return r
|
|
1585
|
+
@
|
|
1586
|
+
|
|
1587
|
+
Let's add a test.
|
|
1588
|
+
This should return a dictionary.
|
|
1589
|
+
<<test functions>>=
|
|
1590
|
+
def test_organization_info_JSON():
|
|
1591
|
+
r = ladok.organization_info_JSON()
|
|
1592
|
+
assert type(r) == dict
|
|
1593
|
+
@
|
|
1594
|
+
|
|
1595
|
+
The output looks like this:
|
|
1596
|
+
\begin{pycode}[apitest]
|
|
1597
|
+
print(r"\begin{minted}{JSON}")
|
|
1598
|
+
print(json.dumps(ladok3.clean_data(ladok.organization_info_JSON()), indent=2))
|
|
1599
|
+
print(r"\end{minted}")
|
|
1600
|
+
\end{pycode}
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
\section{[[larosatesinformation_JSON]]}
|
|
1604
|
+
|
|
1605
|
+
<<LadokSession data methods>>=
|
|
1606
|
+
# added by GQMJr
|
|
1607
|
+
def larosatesinformation_JSON(self):
|
|
1608
|
+
"""
|
|
1609
|
+
Returns a dictionary of the university or college information.
|
|
1610
|
+
"""
|
|
1611
|
+
r = self.session.get(
|
|
1612
|
+
url=self.base_gui_proxy_url +
|
|
1613
|
+
'/kataloginformation/internal/grunddata/larosatesinformation',
|
|
1614
|
+
headers=self.headers).json()
|
|
1615
|
+
return r
|
|
1616
|
+
@
|
|
1617
|
+
|
|
1618
|
+
Let's add a test.
|
|
1619
|
+
This should return a dictionary.
|
|
1620
|
+
<<test functions>>=
|
|
1621
|
+
def test_larosatesinformation_JSON():
|
|
1622
|
+
r = ladok.larosatesinformation_JSON()
|
|
1623
|
+
assert type(r) == dict
|
|
1624
|
+
@
|
|
1625
|
+
|
|
1626
|
+
The output looks like this:
|
|
1627
|
+
\begin{pycode}[apitest]
|
|
1628
|
+
print(r"\begin{minted}{JSON}")
|
|
1629
|
+
print(json.dumps(ladok3.clean_data(ladok.larosatesinformation_JSON()),
|
|
1630
|
+
indent=2))
|
|
1631
|
+
print(r"\end{minted}")
|
|
1632
|
+
\end{pycode}
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
\section{[[undervisningssprak_JSON]]}
|
|
1636
|
+
|
|
1637
|
+
<<LadokSession data methods>>=
|
|
1638
|
+
# added by GQMJr
|
|
1639
|
+
def undervisningssprak_JSON(self):
|
|
1640
|
+
"""
|
|
1641
|
+
Returns a dictionary of teaching languages.
|
|
1642
|
+
"""
|
|
1643
|
+
r = self.session.get(
|
|
1644
|
+
url=self.base_gui_proxy_url +
|
|
1645
|
+
'/kataloginformation/internal/grunddata/undervisningssprak',
|
|
1646
|
+
headers=self.headers).json()
|
|
1647
|
+
return r
|
|
1648
|
+
@
|
|
1649
|
+
|
|
1650
|
+
Let's add a test.
|
|
1651
|
+
This should return a dictionary.
|
|
1652
|
+
<<test functions>>=
|
|
1653
|
+
def test_undervisningssprak_JSON():
|
|
1654
|
+
r = ladok.undervisningssprak_JSON()
|
|
1655
|
+
assert type(r) == dict
|
|
1656
|
+
@
|
|
1657
|
+
|
|
1658
|
+
The output looks like this:
|
|
1659
|
+
\begin{pycode}[apitest]
|
|
1660
|
+
print(r"\begin{minted}{JSON}")
|
|
1661
|
+
print(json.dumps(ladok3.clean_data(ladok.undervisningssprak_JSON()), indent=2))
|
|
1662
|
+
print(r"\end{minted}")
|
|
1663
|
+
\end{pycode}
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
\section{[[i18n_translation_JSON]]}
|
|
1667
|
+
|
|
1668
|
+
<<LadokSession data methods>>=
|
|
1669
|
+
# added by GQMJr
|
|
1670
|
+
def i18n_translation_JSON(self, lang = 'sv'):
|
|
1671
|
+
"""
|
|
1672
|
+
Returns a dictionary of i18n translations used in Ladok3.
|
|
1673
|
+
"""
|
|
1674
|
+
r = self.session.get(
|
|
1675
|
+
url=self.base_gui_proxy_url +
|
|
1676
|
+
'/kataloginformation/internal/i18n/oversattningar/sprakkod/' + lang,
|
|
1677
|
+
headers=self.headers).json()
|
|
1678
|
+
return r
|
|
1679
|
+
@
|
|
1680
|
+
|
|
1681
|
+
Let's add a test.
|
|
1682
|
+
This should return a dictionary.
|
|
1683
|
+
<<test functions>>=
|
|
1684
|
+
def test_i18n_translation_JSON():
|
|
1685
|
+
r = ladok.i18n_translation_JSON()
|
|
1686
|
+
assert type(r) == dict
|
|
1687
|
+
@
|
|
1688
|
+
|
|
1689
|
+
The output looks like this:
|
|
1690
|
+
\begin{pycode}[apitest]
|
|
1691
|
+
print(r"\begin{minted}{JSON}")
|
|
1692
|
+
print(json.dumps(ladok3.clean_data(ladok.i18n_translation_JSON()), indent=2))
|
|
1693
|
+
print(r"\end{minted}")
|
|
1694
|
+
\end{pycode}
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
|
|
1698
|
+
\section{[[svenskorter_JSON]]}
|
|
1699
|
+
|
|
1700
|
+
<<LadokSession data methods>>=
|
|
1701
|
+
# added by GQMJr
|
|
1702
|
+
def svenskorter_JSON(self):
|
|
1703
|
+
"""
|
|
1704
|
+
Returns a dictionary of Swedish places with their KommunID.
|
|
1705
|
+
"""
|
|
1706
|
+
r = self.session.get(
|
|
1707
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/grunddata/svenskort',
|
|
1708
|
+
headers=self.headers).json()
|
|
1709
|
+
return r
|
|
1710
|
+
@
|
|
1711
|
+
|
|
1712
|
+
Let's add a test.
|
|
1713
|
+
This should return a dictionary.
|
|
1714
|
+
<<test functions>>=
|
|
1715
|
+
def test_svenskorter_JSON():
|
|
1716
|
+
r = ladok.svenskorter_JSON()
|
|
1717
|
+
assert type(r) == dict
|
|
1718
|
+
@
|
|
1719
|
+
|
|
1720
|
+
The output looks like this:
|
|
1721
|
+
\begin{pycode}[apitest]
|
|
1722
|
+
print(r"\begin{minted}{JSON}")
|
|
1723
|
+
print(json.dumps(ladok3.clean_data(ladok.svenskorter_JSON()), indent=2))
|
|
1724
|
+
print(r"\end{minted}")
|
|
1725
|
+
\end{pycode}
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
\section{[[kommuner_JSON]]}
|
|
1730
|
+
|
|
1731
|
+
<<LadokSession data methods>>=
|
|
1732
|
+
# added by GQMJr
|
|
1733
|
+
def kommuner_JSON(self):
|
|
1734
|
+
"""
|
|
1735
|
+
Returns a dictionary of Swedish municipalities.
|
|
1736
|
+
"""
|
|
1737
|
+
r = self.session.get(
|
|
1738
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/grunddata/kommun',
|
|
1739
|
+
headers=self.headers).json()
|
|
1740
|
+
return r
|
|
1741
|
+
@
|
|
1742
|
+
|
|
1743
|
+
Let's add a test.
|
|
1744
|
+
This should return a dictionary.
|
|
1745
|
+
<<test functions>>=
|
|
1746
|
+
def test_kommuner_JSON():
|
|
1747
|
+
r = ladok.kommuner_JSON()
|
|
1748
|
+
assert type(r) == dict
|
|
1749
|
+
@
|
|
1750
|
+
|
|
1751
|
+
The output looks like this:
|
|
1752
|
+
\begin{pycode}[apitest]
|
|
1753
|
+
print(r"\begin{minted}{JSON}")
|
|
1754
|
+
print(json.dumps(ladok3.clean_data(ladok.kommuner_JSON()), indent=2))
|
|
1755
|
+
print(r"\end{minted}")
|
|
1756
|
+
\end{pycode}
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
\section{[[lander_JSON]]}
|
|
1760
|
+
|
|
1761
|
+
<<LadokSession data methods>>=
|
|
1762
|
+
# added by GQMJr
|
|
1763
|
+
def lander_JSON(self):
|
|
1764
|
+
"""
|
|
1765
|
+
Returns a dictionary of countries.
|
|
1766
|
+
"""
|
|
1767
|
+
r = self.session.get(
|
|
1768
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/grunddata/land',
|
|
1769
|
+
headers=self.headers).json()
|
|
1770
|
+
return r
|
|
1771
|
+
@
|
|
1772
|
+
|
|
1773
|
+
Let's add a test.
|
|
1774
|
+
This should return a dictionary.
|
|
1775
|
+
<<test functions>>=
|
|
1776
|
+
def test_lander_JSON():
|
|
1777
|
+
r = ladok.lander_JSON()
|
|
1778
|
+
assert type(r) == dict
|
|
1779
|
+
@
|
|
1780
|
+
|
|
1781
|
+
The output looks like this:
|
|
1782
|
+
\begin{pycode}[apitest]
|
|
1783
|
+
print(r"\begin{minted}{JSON}")
|
|
1784
|
+
print(json.dumps(ladok3.clean_data(ladok.lander_JSON()), indent=2))
|
|
1785
|
+
print(r"\end{minted}")
|
|
1786
|
+
\end{pycode}
|
|
1787
|
+
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
\section{[[undervisningstid_JSON]]}
|
|
1791
|
+
|
|
1792
|
+
<<LadokSession data methods>>=
|
|
1793
|
+
# added by GQMJr
|
|
1794
|
+
def undervisningstid_JSON(self):
|
|
1795
|
+
"""
|
|
1796
|
+
Returns a dictionary of teaching times.
|
|
1797
|
+
"""
|
|
1798
|
+
r = self.session.get(
|
|
1799
|
+
url=self.base_gui_proxy_url +
|
|
1800
|
+
'/kataloginformation/internal/grunddata/undervisningstid',
|
|
1801
|
+
headers=self.headers).json()
|
|
1802
|
+
return r
|
|
1803
|
+
@
|
|
1804
|
+
|
|
1805
|
+
Let's add a test.
|
|
1806
|
+
This should return a dictionary.
|
|
1807
|
+
<<test functions>>=
|
|
1808
|
+
def test_undervisningstid_JSON():
|
|
1809
|
+
r = ladok.undervisningstid_JSON()
|
|
1810
|
+
assert type(r) == dict
|
|
1811
|
+
@
|
|
1812
|
+
|
|
1813
|
+
The output looks like this:
|
|
1814
|
+
\begin{pycode}[apitest]
|
|
1815
|
+
print(r"\begin{minted}{JSON}")
|
|
1816
|
+
print(json.dumps(ladok3.clean_data(ladok.undervisningstid_JSON()), indent=2))
|
|
1817
|
+
print(r"\end{minted}")
|
|
1818
|
+
\end{pycode}
|
|
1819
|
+
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
\section{[[successivfordjupning_JSON]]}
|
|
1823
|
+
|
|
1824
|
+
<<LadokSession data methods>>=
|
|
1825
|
+
# RETURNERAR JSON of Successive Specializations
|
|
1826
|
+
def successivfordjupning_JSON(self):
|
|
1827
|
+
"""
|
|
1828
|
+
Returns a dictionary of Successive Specializations.
|
|
1829
|
+
"""
|
|
1830
|
+
r = self.session.get(
|
|
1831
|
+
url=self.base_gui_proxy_url +
|
|
1832
|
+
'/kataloginformation/internal/grunddata/successivfordjupning',
|
|
1833
|
+
headers=self.headers).json()
|
|
1834
|
+
return r
|
|
1835
|
+
@
|
|
1836
|
+
|
|
1837
|
+
Let's add a test.
|
|
1838
|
+
This should return a dictionary.
|
|
1839
|
+
<<test functions>>=
|
|
1840
|
+
def test_successivfordjupning_JSON():
|
|
1841
|
+
r = ladok.successivfordjupning_JSON()
|
|
1842
|
+
assert type(r) == dict
|
|
1843
|
+
@
|
|
1844
|
+
|
|
1845
|
+
The output looks like this:
|
|
1846
|
+
\begin{pycode}[apitest]
|
|
1847
|
+
print(r"\begin{minted}{JSON}")
|
|
1848
|
+
print(json.dumps(ladok3.clean_data(ladok.successivfordjupning_JSON()),
|
|
1849
|
+
indent=2))
|
|
1850
|
+
print(r"\end{minted}")
|
|
1851
|
+
\end{pycode}
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
\section{[[undervisningsform_JSON]]}
|
|
1855
|
+
|
|
1856
|
+
<<LadokSession data methods>>=
|
|
1857
|
+
# added by GQMJr
|
|
1858
|
+
def undervisningsform_JSON(self):
|
|
1859
|
+
"""
|
|
1860
|
+
Returns forms of education.
|
|
1861
|
+
"""
|
|
1862
|
+
r = self.session.get(
|
|
1863
|
+
url=self.base_gui_proxy_url +
|
|
1864
|
+
'/kataloginformation/internal/grunddata/undervisningsform',
|
|
1865
|
+
headers=self.headers).json()
|
|
1866
|
+
return r
|
|
1867
|
+
@
|
|
1868
|
+
|
|
1869
|
+
Let's add a test.
|
|
1870
|
+
This should return a dictionary.
|
|
1871
|
+
<<test functions>>=
|
|
1872
|
+
def test_undervisningsform_JSON():
|
|
1873
|
+
r = ladok.undervisningsform_JSON()
|
|
1874
|
+
assert type(r) == dict
|
|
1875
|
+
@
|
|
1876
|
+
|
|
1877
|
+
The output looks like this:
|
|
1878
|
+
\begin{pycode}[apitest]
|
|
1879
|
+
print(r"\begin{minted}{JSON}")
|
|
1880
|
+
print(json.dumps(ladok3.clean_data(ladok.undervisningsform_JSON()), indent=2))
|
|
1881
|
+
print(r"\end{minted}")
|
|
1882
|
+
\end{pycode}
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
\section{[[LokalaPerioder_JSON]]}
|
|
1887
|
+
|
|
1888
|
+
<<LadokSession data methods>>=
|
|
1889
|
+
# added by GQMJr
|
|
1890
|
+
def LokalaPerioder_JSON(self):
|
|
1891
|
+
"""
|
|
1892
|
+
Returns local periods.
|
|
1893
|
+
"""
|
|
1894
|
+
r = self.session.get(
|
|
1895
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/grunddata/period',
|
|
1896
|
+
headers=self.headers).json()
|
|
1897
|
+
return r
|
|
1898
|
+
@
|
|
1899
|
+
|
|
1900
|
+
Let's add a test.
|
|
1901
|
+
This should return a dictionary.
|
|
1902
|
+
<<test functions>>=
|
|
1903
|
+
def test_LokalaPerioder_JSON():
|
|
1904
|
+
r = ladok.LokalaPerioder_JSON()
|
|
1905
|
+
assert type(r) == dict
|
|
1906
|
+
@
|
|
1907
|
+
|
|
1908
|
+
The output looks like this:
|
|
1909
|
+
\begin{pycode}[apitest]
|
|
1910
|
+
print(r"\begin{minted}{JSON}")
|
|
1911
|
+
print(json.dumps(ladok3.clean_data(ladok.LokalaPerioder_JSON()), indent=2))
|
|
1912
|
+
print(r"\end{minted}")
|
|
1913
|
+
\end{pycode}
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
\section{[[nivainomstudieordning_JSON]]}
|
|
1918
|
+
|
|
1919
|
+
<<LadokSession data methods>>=
|
|
1920
|
+
# added by GQMJr
|
|
1921
|
+
def nivainomstudieordning_JSON(self):
|
|
1922
|
+
"""
|
|
1923
|
+
Returns education levels.
|
|
1924
|
+
"""
|
|
1925
|
+
r = self.session.get(
|
|
1926
|
+
url=self.base_gui_proxy_url +
|
|
1927
|
+
'/kataloginformation/internal/grunddata/nivainomstudieordning',
|
|
1928
|
+
headers=self.headers).json()
|
|
1929
|
+
return r
|
|
1930
|
+
@
|
|
1931
|
+
|
|
1932
|
+
Let's add a test.
|
|
1933
|
+
This should return a dictionary.
|
|
1934
|
+
<<test functions>>=
|
|
1935
|
+
def test_nivainomstudieordning_JSON():
|
|
1936
|
+
r = ladok.nivainomstudieordning_JSON()
|
|
1937
|
+
assert type(r) == dict
|
|
1938
|
+
@
|
|
1939
|
+
|
|
1940
|
+
The output looks like this:
|
|
1941
|
+
\begin{pycode}[apitest]
|
|
1942
|
+
print(r"\begin{minted}{JSON}")
|
|
1943
|
+
print(json.dumps(ladok3.clean_data(ladok.nivainomstudieordning_JSON()),
|
|
1944
|
+
indent=2))
|
|
1945
|
+
print(r"\end{minted}")
|
|
1946
|
+
\end{pycode}
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
|
|
1950
|
+
\section{[[amnesgrupp_JSON]]}
|
|
1951
|
+
|
|
1952
|
+
<<LadokSession data methods>>=
|
|
1953
|
+
# added by GQMJr
|
|
1954
|
+
def amnesgrupp_JSON(self):
|
|
1955
|
+
"""
|
|
1956
|
+
Returns subject area groups.
|
|
1957
|
+
"""
|
|
1958
|
+
r = self.session.get(
|
|
1959
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/grunddata/amnesgrupp',
|
|
1960
|
+
headers=self.headers).json()
|
|
1961
|
+
return r
|
|
1962
|
+
@
|
|
1963
|
+
|
|
1964
|
+
Let's add a test.
|
|
1965
|
+
This should return a dictionary.
|
|
1966
|
+
<<test functions>>=
|
|
1967
|
+
def test_amnesgrupp_JSON():
|
|
1968
|
+
r = ladok.amnesgrupp_JSON()
|
|
1969
|
+
assert type(r) == dict
|
|
1970
|
+
@
|
|
1971
|
+
|
|
1972
|
+
The output looks like this:
|
|
1973
|
+
\begin{pycode}[apitest]
|
|
1974
|
+
print(r"\begin{minted}{JSON}")
|
|
1975
|
+
print(json.dumps(ladok3.clean_data(ladok.amnesgrupp_JSON()), indent=2))
|
|
1976
|
+
print(r"\end{minted}")
|
|
1977
|
+
\end{pycode}
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
\section{[[studietakt_JSON]]}
|
|
1983
|
+
|
|
1984
|
+
<<LadokSession data methods>>=
|
|
1985
|
+
# added by GQMJr
|
|
1986
|
+
def studietakt_JSON(self):
|
|
1987
|
+
"""
|
|
1988
|
+
Returns study paces.
|
|
1989
|
+
"""
|
|
1990
|
+
r = self.session.get(
|
|
1991
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/grunddata/studietakt',
|
|
1992
|
+
headers=self.headers).json()
|
|
1993
|
+
return r
|
|
1994
|
+
@
|
|
1995
|
+
|
|
1996
|
+
Let's add a test.
|
|
1997
|
+
This should return a dictionary.
|
|
1998
|
+
<<test functions>>=
|
|
1999
|
+
def test_studietakt_JSON():
|
|
2000
|
+
r = ladok.studietakt_JSON()
|
|
2001
|
+
assert type(r) == dict
|
|
2002
|
+
@
|
|
2003
|
+
|
|
2004
|
+
The output looks like this:
|
|
2005
|
+
\begin{pycode}[apitest]
|
|
2006
|
+
print(r"\begin{minted}{JSON}")
|
|
2007
|
+
print(json.dumps(ladok3.clean_data(ladok.studietakt_JSON()), indent=2))
|
|
2008
|
+
print(r"\end{minted}")
|
|
2009
|
+
\end{pycode}
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
\section{[[finansieringsform_JSON]]}
|
|
2015
|
+
|
|
2016
|
+
<<LadokSession data methods>>=
|
|
2017
|
+
# added by GQMJr
|
|
2018
|
+
def finansieringsform_JSON(self):
|
|
2019
|
+
"""
|
|
2020
|
+
Returns forms of financing.
|
|
2021
|
+
"""
|
|
2022
|
+
r = self.session.get(
|
|
2023
|
+
url=self.base_gui_proxy_url +
|
|
2024
|
+
'/kataloginformation/internal/grunddata/finansieringsform',
|
|
2025
|
+
headers=self.headers).json()
|
|
2026
|
+
return r
|
|
2027
|
+
@
|
|
2028
|
+
|
|
2029
|
+
Let's add a test.
|
|
2030
|
+
This should return a dictionary.
|
|
2031
|
+
<<test functions>>=
|
|
2032
|
+
def test_finansieringsform_JSON():
|
|
2033
|
+
r = ladok.finansieringsform_JSON()
|
|
2034
|
+
assert type(r) == dict
|
|
2035
|
+
@
|
|
2036
|
+
|
|
2037
|
+
The output looks like this:
|
|
2038
|
+
\begin{pycode}[apitest]
|
|
2039
|
+
print(r"\begin{minted}{JSON}")
|
|
2040
|
+
print(json.dumps(ladok3.clean_data(ladok.finansieringsform_JSON()), indent=2))
|
|
2041
|
+
print(r"\end{minted}")
|
|
2042
|
+
\end{pycode}
|
|
2043
|
+
|
|
2044
|
+
|
|
2045
|
+
\section{[[utbildningsomrade_JSON]]}
|
|
2046
|
+
|
|
2047
|
+
<<LadokSession data methods>>=
|
|
2048
|
+
# added by GQMJr
|
|
2049
|
+
def utbildningsomrade_JSON(self):
|
|
2050
|
+
"""
|
|
2051
|
+
Returns subject areas.
|
|
2052
|
+
"""
|
|
2053
|
+
r = self.session.get(
|
|
2054
|
+
url=self.base_gui_proxy_url +
|
|
2055
|
+
'/kataloginformation/internal/grunddata/utbildningsomrade',
|
|
2056
|
+
headers=self.headers).json()
|
|
2057
|
+
return r
|
|
2058
|
+
@
|
|
2059
|
+
|
|
2060
|
+
Let's add a test.
|
|
2061
|
+
This should return a dictionary.
|
|
2062
|
+
<<test functions>>=
|
|
2063
|
+
def test_utbildningsomrade_JSON():
|
|
2064
|
+
r = ladok.utbildningsomrade_JSON()
|
|
2065
|
+
assert type(r) == dict
|
|
2066
|
+
@
|
|
2067
|
+
|
|
2068
|
+
The output looks like this:
|
|
2069
|
+
\begin{pycode}[apitest]
|
|
2070
|
+
print(r"\begin{minted}{JSON}")
|
|
2071
|
+
print(json.dumps(ladok3.clean_data(ladok.utbildningsomrade_JSON()), indent=2))
|
|
2072
|
+
print(r"\end{minted}")
|
|
2073
|
+
\end{pycode}
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
\section{[[kravpatidigarestudier_JSON]]}
|
|
2077
|
+
|
|
2078
|
+
<<LadokSession data methods>>=
|
|
2079
|
+
# added by GQMJr
|
|
2080
|
+
def kravpatidigarestudier_JSON(self):
|
|
2081
|
+
"""
|
|
2082
|
+
Returns requirements for earlier studies.
|
|
2083
|
+
"""
|
|
2084
|
+
r = self.session.get(
|
|
2085
|
+
url=self.base_gui_proxy_url +
|
|
2086
|
+
'/kataloginformation/internal/grunddata/kravpatidigarestudier',
|
|
2087
|
+
headers=self.headers).json()
|
|
2088
|
+
return r
|
|
2089
|
+
@
|
|
2090
|
+
|
|
2091
|
+
Let's add a test.
|
|
2092
|
+
This should return a dictionary.
|
|
2093
|
+
<<test functions>>=
|
|
2094
|
+
def test_kravpatidigarestudier_JSON():
|
|
2095
|
+
r = ladok.kravpatidigarestudier_JSON()
|
|
2096
|
+
assert type(r) == dict
|
|
2097
|
+
@
|
|
2098
|
+
|
|
2099
|
+
The output looks like this:
|
|
2100
|
+
\begin{pycode}[apitest]
|
|
2101
|
+
print(r"\begin{minted}{JSON}")
|
|
2102
|
+
print(json.dumps(ladok3.clean_data(ladok.kravpatidigarestudier_JSON()),
|
|
2103
|
+
indent=2))
|
|
2104
|
+
print(r"\end{minted}")
|
|
2105
|
+
\end{pycode}
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
\section{[[studieordning_JSON]]}
|
|
2110
|
+
|
|
2111
|
+
<<LadokSession data methods>>=
|
|
2112
|
+
# added by GQMJr
|
|
2113
|
+
def studieordning_JSON(self):
|
|
2114
|
+
"""
|
|
2115
|
+
Returns study regulations.
|
|
2116
|
+
"""
|
|
2117
|
+
r = self.session.get(
|
|
2118
|
+
url=self.base_gui_proxy_url +
|
|
2119
|
+
'/kataloginformation/internal/grunddata/studieordning',
|
|
2120
|
+
headers=self.headers).json()
|
|
2121
|
+
return r
|
|
2122
|
+
@
|
|
2123
|
+
|
|
2124
|
+
Let's add a test.
|
|
2125
|
+
This should return a dictionary.
|
|
2126
|
+
<<test functions>>=
|
|
2127
|
+
def test_studieordning_JSON():
|
|
2128
|
+
r = ladok.studieordning_JSON()
|
|
2129
|
+
assert type(r) == dict
|
|
2130
|
+
@
|
|
2131
|
+
|
|
2132
|
+
The output looks like this:
|
|
2133
|
+
\begin{pycode}[apitest]
|
|
2134
|
+
print(r"\begin{minted}{JSON}")
|
|
2135
|
+
print(json.dumps(ladok3.clean_data(ladok.studieordning_JSON()), indent=2))
|
|
2136
|
+
print(r"\end{minted}")
|
|
2137
|
+
\end{pycode}
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
\section{[[enhet_JSON]]}
|
|
2142
|
+
|
|
2143
|
+
<<LadokSession data methods>>=
|
|
2144
|
+
# added by GQMJr
|
|
2145
|
+
def enhet_JSON(self):
|
|
2146
|
+
"""
|
|
2147
|
+
Returns credit units.
|
|
2148
|
+
"""
|
|
2149
|
+
r = self.session.get(
|
|
2150
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/grunddata/enhet',
|
|
2151
|
+
headers=self.headers).json()
|
|
2152
|
+
return r
|
|
2153
|
+
@
|
|
2154
|
+
|
|
2155
|
+
Let's add a test.
|
|
2156
|
+
This should return a dictionary.
|
|
2157
|
+
<<test functions>>=
|
|
2158
|
+
def test_enhet_JSON():
|
|
2159
|
+
r = ladok.enhet_JSON()
|
|
2160
|
+
assert type(r) == dict
|
|
2161
|
+
@
|
|
2162
|
+
|
|
2163
|
+
The output looks like this:
|
|
2164
|
+
\begin{pycode}[apitest]
|
|
2165
|
+
print(r"\begin{minted}{JSON}")
|
|
2166
|
+
print(json.dumps(ladok3.clean_data(ladok.enhet_JSON()), indent=2))
|
|
2167
|
+
print(r"\end{minted}")
|
|
2168
|
+
\end{pycode}
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
\section{[[studielokalisering_JSON]]}
|
|
2172
|
+
|
|
2173
|
+
<<LadokSession data methods>>=
|
|
2174
|
+
# added by GQMJr
|
|
2175
|
+
def studielokalisering_JSON(self):
|
|
2176
|
+
"""
|
|
2177
|
+
Returns study locations.
|
|
2178
|
+
"""
|
|
2179
|
+
r = self.session.get(
|
|
2180
|
+
url=self.base_gui_proxy_url +
|
|
2181
|
+
'/kataloginformation/internal/grunddata/studielokalisering',
|
|
2182
|
+
headers=self.headers).json()
|
|
2183
|
+
return r
|
|
2184
|
+
@
|
|
2185
|
+
|
|
2186
|
+
Let's add a test.
|
|
2187
|
+
This should return a dictionary.
|
|
2188
|
+
<<test functions>>=
|
|
2189
|
+
def test_studielokalisering_JSON():
|
|
2190
|
+
r = ladok.studielokalisering_JSON()
|
|
2191
|
+
assert type(r) == dict
|
|
2192
|
+
@
|
|
2193
|
+
|
|
2194
|
+
The output looks like this:
|
|
2195
|
+
\begin{pycode}[apitest]
|
|
2196
|
+
print(r"\begin{minted}{JSON}")
|
|
2197
|
+
print(json.dumps(ladok3.clean_data(ladok.studielokalisering_JSON()), indent=2))
|
|
2198
|
+
print(r"\end{minted}")
|
|
2199
|
+
\end{pycode}
|
|
2200
|
+
|
|
2201
|
+
|
|
2202
|
+
\section{[[antagningsomgang_JSON]]}
|
|
2203
|
+
|
|
2204
|
+
<<LadokSession data methods>>=
|
|
2205
|
+
# added by GQMJr
|
|
2206
|
+
def antagningsomgang_JSON(self):
|
|
2207
|
+
"""
|
|
2208
|
+
Returns the admission round.
|
|
2209
|
+
"""
|
|
2210
|
+
r = self.session.get(
|
|
2211
|
+
url=self.base_gui_proxy_url +
|
|
2212
|
+
'/kataloginformation/internal/grunddata/antagningsomgang',
|
|
2213
|
+
headers=self.headers).json()
|
|
2214
|
+
return r
|
|
2215
|
+
@
|
|
2216
|
+
|
|
2217
|
+
Let's add a test.
|
|
2218
|
+
This should return a dictionary.
|
|
2219
|
+
<<test functions>>=
|
|
2220
|
+
def test_antagningsomgang_JSON():
|
|
2221
|
+
r = ladok.antagningsomgang_JSON()
|
|
2222
|
+
assert type(r) == dict
|
|
2223
|
+
@
|
|
2224
|
+
|
|
2225
|
+
The output looks like this:
|
|
2226
|
+
\begin{pycode}[apitest]
|
|
2227
|
+
print(r"\begin{minted}{JSON}")
|
|
2228
|
+
print(json.dumps(ladok3.clean_data(ladok.antagningsomgang_JSON()), indent=2))
|
|
2229
|
+
print(r"\end{minted}")
|
|
2230
|
+
\end{pycode}
|
|
2231
|
+
|
|
2232
|
+
|
|
2233
|
+
\section{[[utbildningstyp_JSON]]}
|
|
2234
|
+
|
|
2235
|
+
<<LadokSession data methods>>=
|
|
2236
|
+
# added by GQMJr
|
|
2237
|
+
def utbildningstyp_JSON(self):
|
|
2238
|
+
"""
|
|
2239
|
+
Returns types of education.
|
|
2240
|
+
|
|
2241
|
+
For information about these, see
|
|
2242
|
+
|
|
2243
|
+
https://ladok.se/wp-content/uploads/2018/01/Funktionsbeskrivning_095.pdf
|
|
2244
|
+
"""
|
|
2245
|
+
r = self.session.get(
|
|
2246
|
+
url=self.base_gui_proxy_url +
|
|
2247
|
+
'/kataloginformation/internal/grunddata/utbildningstyp',
|
|
2248
|
+
headers=self.headers).json()
|
|
2249
|
+
return r
|
|
2250
|
+
@
|
|
2251
|
+
|
|
2252
|
+
Let's add a test.
|
|
2253
|
+
This should return a dictionary.
|
|
2254
|
+
<<test functions>>=
|
|
2255
|
+
def test_utbildningstyp_JSON():
|
|
2256
|
+
r = ladok.utbildningstyp_JSON()
|
|
2257
|
+
assert type(r) == dict
|
|
2258
|
+
@
|
|
2259
|
+
|
|
2260
|
+
The output looks like this:
|
|
2261
|
+
\begin{pycode}[apitest]
|
|
2262
|
+
print(r"\begin{minted}{JSON}")
|
|
2263
|
+
print(json.dumps(ladok3.clean_data(ladok.utbildningstyp_JSON()), indent=2))
|
|
2264
|
+
print(r"\end{minted}")
|
|
2265
|
+
\end{pycode}
|
|
2266
|
+
|
|
2267
|
+
|
|
2268
|
+
\section{[[aktivitetstillfallestyp_JSON]]}
|
|
2269
|
+
|
|
2270
|
+
<<LadokSession data methods>>=
|
|
2271
|
+
# added by GQMJr
|
|
2272
|
+
def aktivitetstillfallestyp_JSON(self):
|
|
2273
|
+
"""
|
|
2274
|
+
Returns the activity types.
|
|
2275
|
+
"""
|
|
2276
|
+
r = self.session.get(
|
|
2277
|
+
url=self.base_gui_proxy_url +
|
|
2278
|
+
'/kataloginformation/internal/grunddata/aktivitetstillfallestyp',
|
|
2279
|
+
headers=self.headers).json()
|
|
2280
|
+
return r
|
|
2281
|
+
@
|
|
2282
|
+
|
|
2283
|
+
Let's add a test.
|
|
2284
|
+
This should return a dictionary.
|
|
2285
|
+
<<test functions>>=
|
|
2286
|
+
def test_aktivitetstillfallestyp_JSON():
|
|
2287
|
+
r = ladok.aktivitetstillfallestyp_JSON()
|
|
2288
|
+
assert type(r) == dict
|
|
2289
|
+
@
|
|
2290
|
+
|
|
2291
|
+
The output looks like this:
|
|
2292
|
+
\begin{pycode}[apitest]
|
|
2293
|
+
print(r"\begin{minted}{JSON}")
|
|
2294
|
+
print(json.dumps(ladok3.clean_data(ladok.aktivitetstillfallestyp_JSON()),
|
|
2295
|
+
indent=2))
|
|
2296
|
+
print(r"\end{minted}")
|
|
2297
|
+
\end{pycode}
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
\section{[[catalog_service_index_JSON]]}
|
|
2301
|
+
|
|
2302
|
+
<<LadokSession data methods>>=
|
|
2303
|
+
# added by GQMJr
|
|
2304
|
+
def catalog_service_index_JSON(self):
|
|
2305
|
+
"""
|
|
2306
|
+
Returns the catalog service index.
|
|
2307
|
+
"""
|
|
2308
|
+
r = self.session.get(
|
|
2309
|
+
url=self.base_gui_proxy_url + '/kataloginformation/internal/service/index',
|
|
2310
|
+
headers=self.headers).json()
|
|
2311
|
+
return r
|
|
2312
|
+
@
|
|
2313
|
+
|
|
2314
|
+
Let's add a test.
|
|
2315
|
+
This should return a dictionary.
|
|
2316
|
+
<<test functions>>=
|
|
2317
|
+
def test_catalog_service_index_JSON():
|
|
2318
|
+
r = ladok.catalog_service_index_JSON()
|
|
2319
|
+
assert type(r) == dict
|
|
2320
|
+
@
|
|
2321
|
+
|
|
2322
|
+
The output looks like this:
|
|
2323
|
+
\begin{pycode}[apitest]
|
|
2324
|
+
print(r"\begin{minted}{JSON}")
|
|
2325
|
+
print(json.dumps(ladok3.clean_data(ladok.catalog_service_index_JSON()),
|
|
2326
|
+
indent=2))
|
|
2327
|
+
print(r"\end{minted}")
|
|
2328
|
+
\end{pycode}
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
\section{[[omradesbehorighet_JSON]]}
|
|
2332
|
+
|
|
2333
|
+
<<LadokSession data methods>>=
|
|
2334
|
+
# added by GQMJr
|
|
2335
|
+
def omradesbehorighet_JSON(self):
|
|
2336
|
+
"""
|
|
2337
|
+
Returns områdesbehörighet. See
|
|
2338
|
+
|
|
2339
|
+
https://antagning.se/globalassets/omradesbehorigheter-hogskolan.pdf
|
|
2340
|
+
|
|
2341
|
+
for more information.
|
|
2342
|
+
"""
|
|
2343
|
+
r = self.session.get(
|
|
2344
|
+
url=self.base_gui_proxy_url +
|
|
2345
|
+
'/kataloginformation/internal/grunddata/omradesbehorighet',
|
|
2346
|
+
headers=self.headers).json()
|
|
2347
|
+
return r
|
|
2348
|
+
@
|
|
2349
|
+
|
|
2350
|
+
Let's add a test.
|
|
2351
|
+
This should return a dictionary.
|
|
2352
|
+
<<test functions>>=
|
|
2353
|
+
def test_omradesbehorighet_JSON():
|
|
2354
|
+
r = ladok.omradesbehorighet_JSON()
|
|
2355
|
+
assert type(r) == dict
|
|
2356
|
+
@
|
|
2357
|
+
|
|
2358
|
+
The output looks like this:
|
|
2359
|
+
\begin{pycode}[apitest]
|
|
2360
|
+
print(r"\begin{minted}{JSON}")
|
|
2361
|
+
print(json.dumps(ladok3.clean_data(ladok.omradesbehorighet_JSON()), indent=2))
|
|
2362
|
+
print(r"\end{minted}")
|
|
2363
|
+
\end{pycode}
|
|
2364
|
+
|