ladok3 4.15__tar.gz → 4.17__tar.gz
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.
- {ladok3-4.15 → ladok3-4.17}/PKG-INFO +2 -2
- {ladok3-4.15 → ladok3-4.17}/pyproject.toml +2 -2
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/cli.nw +59 -53
- {ladok3-4.15 → ladok3-4.17}/LICENSE +0 -0
- {ladok3-4.15 → ladok3-4.17}/README.md +0 -0
- {ladok3-4.15 → ladok3-4.17}/doc/Makefile +0 -0
- {ladok3-4.15 → ladok3-4.17}/doc/abstract.tex +0 -0
- {ladok3-4.15 → ladok3-4.17}/doc/ladok3.tex +0 -0
- {ladok3-4.15 → ladok3-4.17}/doc/preamble.tex +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/doc.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/exam.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/haskell.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/miun.course.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/miun.depend.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/miun.docs.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/miun.port.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/miun.pub.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/noweb.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/pkg.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/portability.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/pub.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/results.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/subdir.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/tex.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/makefiles/transform.mk +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/.gitignore +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/Makefile +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/api.nw +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/data.nw +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/ladok3.nw +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/report.nw +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/student.nw +0 -0
- {ladok3-4.15 → ladok3-4.17}/src/ladok3/undoc.nw +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ladok3
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.17
|
|
4
4
|
Summary: Python wrapper and CLI for the LADOK3 REST API.
|
|
5
5
|
Home-page: https://github.com/dbosk/ladok3
|
|
6
6
|
License: MIT
|
|
@@ -28,7 +28,7 @@ Requires-Dist: cryptography (>=41.0.3,<42.0.0)
|
|
|
28
28
|
Requires-Dist: keyring (>=24.2.0,<25.0.0)
|
|
29
29
|
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
30
30
|
Requires-Dist: urllib3 (>=1.26.9,<2.0.0)
|
|
31
|
-
Requires-Dist: weblogin (>=1.
|
|
31
|
+
Requires-Dist: weblogin (>=1.11,<2.0)
|
|
32
32
|
Project-URL: Bug Tracker, https://github.com/dbosk/ladok3/issues
|
|
33
33
|
Project-URL: Repository, https://github.com/dbosk/ladok3
|
|
34
34
|
Project-URL: Releases, https://github.com/dbosk/ladok3/releases
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "ladok3"
|
|
3
|
-
version = "4.
|
|
3
|
+
version = "4.17"
|
|
4
4
|
description = "Python wrapper and CLI for the LADOK3 REST API."
|
|
5
5
|
authors = [
|
|
6
6
|
"Daniel Bosk <dbosk@kth.se>",
|
|
@@ -56,7 +56,7 @@ cryptography = "^41.0.3"
|
|
|
56
56
|
keyring = "^24.2.0"
|
|
57
57
|
requests = "^2.31.0"
|
|
58
58
|
urllib3 = "^1.26.9"
|
|
59
|
-
weblogin = "^1.
|
|
59
|
+
weblogin = "^1.11"
|
|
60
60
|
|
|
61
61
|
[tool.poetry.dev-dependencies]
|
|
62
62
|
pytest = "^7.1.3"
|
|
@@ -299,21 +299,17 @@ the user.
|
|
|
299
299
|
Manages the user's LADOK login credentials. There are three ways to supply the
|
|
300
300
|
login credentials, in order of priority:
|
|
301
301
|
|
|
302
|
-
1) Through the
|
|
303
|
-
enter the credentials and they will be stored in the keyring. Note that for
|
|
304
|
-
this to work on the WSL platform (and possibly on Windows), you need to
|
|
305
|
-
install the `keyrings.alt` package: `python3 -m pip install keyrings.alt`.
|
|
302
|
+
1) Through the environment: Just set the environment variables
|
|
306
303
|
|
|
307
|
-
|
|
304
|
+
a) LADOK_INST, the name of the institution, e.g. KTH Royal Institute of
|
|
305
|
+
Technology;
|
|
308
306
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
LADOK_USER (the username, e.g. dbosk@ug.kth.se) and
|
|
314
|
-
LADOK_PASS (the password) instead.
|
|
307
|
+
b) LADOK_VARS, a colon-separated list of environment variables, similarly to
|
|
308
|
+
what's done in `ladok login` --- most don't need this, but can rather set
|
|
309
|
+
LADOK_USER (the username, e.g. dbosk@ug.kth.se) and LADOK_PASS (the
|
|
310
|
+
password) instead.
|
|
315
311
|
|
|
316
|
-
|
|
312
|
+
2) Through the configuration file: Just write
|
|
317
313
|
|
|
318
314
|
{{
|
|
319
315
|
"institution": "the name of the university"
|
|
@@ -325,6 +321,17 @@ login credentials, in order of priority:
|
|
|
325
321
|
option). (The keys 'username' and 'password' can be renamed to correspond to
|
|
326
322
|
the necessary values if the university login system uses other names.)
|
|
327
323
|
|
|
324
|
+
3) Through the system keyring: Just run `ladok login` and you'll be asked to
|
|
325
|
+
enter the credentials and they will be stored in the keyring. Note that for
|
|
326
|
+
this to work on the WSL platform (and possibly on Windows), you need to
|
|
327
|
+
install the `keyrings.alt` package: `python3 -m pip install keyrings.alt`.
|
|
328
|
+
|
|
329
|
+
The keyring is the most secure. However, sometimes one want to try different
|
|
330
|
+
credentials, so the environment should override the keyring. Also, on WSL the
|
|
331
|
+
keyring might require you to enter a password in the terminal---this is very
|
|
332
|
+
inconvenient in scripts. However, when logging in, we first try to store the
|
|
333
|
+
credentials in the keyring.
|
|
334
|
+
|
|
328
335
|
<<add subparsers to subp>>=
|
|
329
336
|
login_parser = subp.add_parser("login",
|
|
330
337
|
help="Manage login credentials",
|
|
@@ -510,52 +517,17 @@ def load_credentials(filename="config.json"):
|
|
|
510
517
|
can be passed to `LadokSession(instiution, credential dictionary)`.
|
|
511
518
|
"""
|
|
512
519
|
|
|
513
|
-
<<fetch vars from keyring>>
|
|
514
|
-
<<fetch username and password from keyring>>
|
|
515
520
|
<<fetch institution from environment>>
|
|
516
521
|
<<fetch username and password from environment>>
|
|
517
522
|
<<fetch vars from environment>>
|
|
518
523
|
<<fetch vars from config file>>
|
|
524
|
+
<<fetch vars from keyring>>
|
|
525
|
+
<<fetch username and password from keyring>>
|
|
519
526
|
|
|
520
527
|
return None, None
|
|
521
528
|
@
|
|
522
529
|
|
|
523
|
-
First
|
|
524
|
-
We try to fetch the institution and vars from the keyring.
|
|
525
|
-
|
|
526
|
-
Note that [[keyring]] returns [[None]] if the key doesn't exist, it doesn't
|
|
527
|
-
raise an exception.
|
|
528
|
-
<<fetch vars from keyring>>=
|
|
529
|
-
try:
|
|
530
|
-
institution = keyring.get_password("ladok3", "institution")
|
|
531
|
-
vars_keys = keyring.get_password("ladok3", "vars")
|
|
532
|
-
|
|
533
|
-
vars = {}
|
|
534
|
-
for key in vars_keys.split(";"):
|
|
535
|
-
value = keyring.get_password("ladok3", key)
|
|
536
|
-
if value:
|
|
537
|
-
vars[key] = value
|
|
538
|
-
|
|
539
|
-
if institution and vars:
|
|
540
|
-
return institution, vars
|
|
541
|
-
except:
|
|
542
|
-
pass
|
|
543
|
-
@
|
|
544
|
-
|
|
545
|
-
However, if that fails, we fall back on the previous format, that only
|
|
546
|
-
supported KTH.
|
|
547
|
-
<<fetch username and password from keyring>>=
|
|
548
|
-
try:
|
|
549
|
-
institution = "KTH Royal Institute of Technology"
|
|
550
|
-
username = keyring.get_password("ladok3", "username")
|
|
551
|
-
password = keyring.get_password("ladok3", "password")
|
|
552
|
-
if username and password:
|
|
553
|
-
return institution, {"username": username, "password": password}
|
|
554
|
-
except:
|
|
555
|
-
pass
|
|
556
|
-
@
|
|
557
|
-
|
|
558
|
-
Next in priority is to read from the environment.
|
|
530
|
+
First in priority is to read from the environment.
|
|
559
531
|
We try to read the institution.
|
|
560
532
|
If that fails, we assume we're using the old format that only supported KTH.
|
|
561
533
|
<<fetch institution from environment>>=
|
|
@@ -563,7 +535,6 @@ try:
|
|
|
563
535
|
institution = os.environ["LADOK_INST"]
|
|
564
536
|
except:
|
|
565
537
|
institution = "KTH Royal Institute of Technology"
|
|
566
|
-
|
|
567
538
|
<<fetch username and password from environment>>=
|
|
568
539
|
try:
|
|
569
540
|
vars = {
|
|
@@ -578,6 +549,8 @@ except:
|
|
|
578
549
|
|
|
579
550
|
If we couldn't read the old [[LADOK_USER]] and [[LADOK_PASS]], we try to read
|
|
580
551
|
the [[vars]] from the environment using [[LADOK_VARS]].
|
|
552
|
+
Note that we need the [[institution]] to be set from [[LADOK_INST]] above for
|
|
553
|
+
this.
|
|
581
554
|
<<fetch vars from environment>>=
|
|
582
555
|
try:
|
|
583
556
|
vars_keys = os.environ["LADOK_VARS"]
|
|
@@ -605,8 +578,7 @@ it doesn't exist.
|
|
|
605
578
|
warn(f"Variable {key} not set, ignoring.")
|
|
606
579
|
@
|
|
607
580
|
|
|
608
|
-
If none of the above worked,
|
|
609
|
-
configuration file.
|
|
581
|
+
If none of the above worked, we try the config file next.
|
|
610
582
|
We pop the institution from the configuration file (a dictionary), because then
|
|
611
583
|
the remaining entries will be used as [[vars]].
|
|
612
584
|
<<fetch vars from config file>>=
|
|
@@ -621,6 +593,40 @@ except:
|
|
|
621
593
|
pass
|
|
622
594
|
@
|
|
623
595
|
|
|
596
|
+
Lastly, if nothing else worked, we try to fetch the institution and vars from
|
|
597
|
+
the keyring.
|
|
598
|
+
Note that [[keyring]] returns [[None]] if the key doesn't exist, it doesn't
|
|
599
|
+
raise an exception.
|
|
600
|
+
<<fetch vars from keyring>>=
|
|
601
|
+
try:
|
|
602
|
+
institution = keyring.get_password("ladok3", "institution")
|
|
603
|
+
vars_keys = keyring.get_password("ladok3", "vars")
|
|
604
|
+
|
|
605
|
+
vars = {}
|
|
606
|
+
for key in vars_keys.split(";"):
|
|
607
|
+
value = keyring.get_password("ladok3", key)
|
|
608
|
+
if value:
|
|
609
|
+
vars[key] = value
|
|
610
|
+
|
|
611
|
+
if institution and vars:
|
|
612
|
+
return institution, vars
|
|
613
|
+
except:
|
|
614
|
+
pass
|
|
615
|
+
@
|
|
616
|
+
|
|
617
|
+
However, if that fails, we fall back on the previous format, that only
|
|
618
|
+
supported KTH.
|
|
619
|
+
<<fetch username and password from keyring>>=
|
|
620
|
+
try:
|
|
621
|
+
institution = "KTH Royal Institute of Technology"
|
|
622
|
+
username = keyring.get_password("ladok3", "username")
|
|
623
|
+
password = keyring.get_password("ladok3", "password")
|
|
624
|
+
if username and password:
|
|
625
|
+
return institution, {"username": username, "password": password}
|
|
626
|
+
except:
|
|
627
|
+
pass
|
|
628
|
+
@
|
|
629
|
+
|
|
624
630
|
|
|
625
631
|
\section{Managing the cache: the \texttt{cache} command and subcommands}
|
|
626
632
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|