ladok3 4.15__py3-none-any.whl → 4.17__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 CHANGED
Binary file
ladok3/cli.nw CHANGED
@@ -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 system keyring: Just run `ladok login` and you'll be asked to
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
- 2) Through the environment: Just set the environment variables
304
+ a) LADOK_INST, the name of the institution, e.g. KTH Royal Institute of
305
+ Technology;
308
306
 
309
- a) LADOK_INST, the name of the institution, e.g. KTH Royal Institute of
310
- Technology;
311
- b) LADOK_VARS, a colon-separated list of environment variables, similarly to
312
- what's done in `ladok login` --- most don't need this, but can rather set
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
- 3) Through the configuration file: Just write
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 we try the newest format.
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, the last resort is to try to read the
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
 
ladok3/cli.py CHANGED
@@ -223,33 +223,10 @@ def load_credentials(filename="config.json"):
223
223
  can be passed to `LadokSession(instiution, credential dictionary)`.
224
224
  """
225
225
 
226
- try:
227
- institution = keyring.get_password("ladok3", "institution")
228
- vars_keys = keyring.get_password("ladok3", "vars")
229
-
230
- vars = {}
231
- for key in vars_keys.split(";"):
232
- value = keyring.get_password("ladok3", key)
233
- if value:
234
- vars[key] = value
235
-
236
- if institution and vars:
237
- return institution, vars
238
- except:
239
- pass
240
- try:
241
- institution = "KTH Royal Institute of Technology"
242
- username = keyring.get_password("ladok3", "username")
243
- password = keyring.get_password("ladok3", "password")
244
- if username and password:
245
- return institution, {"username": username, "password": password}
246
- except:
247
- pass
248
226
  try:
249
227
  institution = os.environ["LADOK_INST"]
250
228
  except:
251
229
  institution = "KTH Royal Institute of Technology"
252
-
253
230
  try:
254
231
  vars = {
255
232
  "username": os.environ["LADOK_USER"],
@@ -283,6 +260,28 @@ def load_credentials(filename="config.json"):
283
260
  return institution, config
284
261
  except:
285
262
  pass
263
+ try:
264
+ institution = keyring.get_password("ladok3", "institution")
265
+ vars_keys = keyring.get_password("ladok3", "vars")
266
+
267
+ vars = {}
268
+ for key in vars_keys.split(";"):
269
+ value = keyring.get_password("ladok3", key)
270
+ if value:
271
+ vars[key] = value
272
+
273
+ if institution and vars:
274
+ return institution, vars
275
+ except:
276
+ pass
277
+ try:
278
+ institution = "KTH Royal Institute of Technology"
279
+ username = keyring.get_password("ladok3", "username")
280
+ password = keyring.get_password("ladok3", "password")
281
+ if username and password:
282
+ return institution, {"username": username, "password": password}
283
+ except:
284
+ pass
286
285
 
287
286
  return None, None
288
287
 
@@ -319,21 +318,17 @@ def main():
319
318
  Manages the user's LADOK login credentials. There are three ways to supply the
320
319
  login credentials, in order of priority:
321
320
 
322
- 1) Through the system keyring: Just run `ladok login` and you'll be asked to
323
- enter the credentials and they will be stored in the keyring. Note that for
324
- this to work on the WSL platform (and possibly on Windows), you need to
325
- install the `keyrings.alt` package: `python3 -m pip install keyrings.alt`.
321
+ 1) Through the environment: Just set the environment variables
326
322
 
327
- 2) Through the environment: Just set the environment variables
323
+ a) LADOK_INST, the name of the institution, e.g. KTH Royal Institute of
324
+ Technology;
328
325
 
329
- a) LADOK_INST, the name of the institution, e.g. KTH Royal Institute of
330
- Technology;
331
- b) LADOK_VARS, a colon-separated list of environment variables, similarly to
332
- what's done in `ladok login` --- most don't need this, but can rather set
333
- LADOK_USER (the username, e.g. dbosk@ug.kth.se) and
334
- LADOK_PASS (the password) instead.
326
+ b) LADOK_VARS, a colon-separated list of environment variables, similarly to
327
+ what's done in `ladok login` --- most don't need this, but can rather set
328
+ LADOK_USER (the username, e.g. dbosk@ug.kth.se) and LADOK_PASS (the
329
+ password) instead.
335
330
 
336
- 3) Through the configuration file: Just write
331
+ 2) Through the configuration file: Just write
337
332
 
338
333
  {{
339
334
  "institution": "the name of the university"
@@ -345,6 +340,17 @@ def main():
345
340
  option). (The keys 'username' and 'password' can be renamed to correspond to
346
341
  the necessary values if the university login system uses other names.)
347
342
 
343
+ 3) Through the system keyring: Just run `ladok login` and you'll be asked to
344
+ enter the credentials and they will be stored in the keyring. Note that for
345
+ this to work on the WSL platform (and possibly on Windows), you need to
346
+ install the `keyrings.alt` package: `python3 -m pip install keyrings.alt`.
347
+
348
+ The keyring is the most secure. However, sometimes one want to try different
349
+ credentials, so the environment should override the keyring. Also, on WSL the
350
+ keyring might require you to enter a password in the terminal---this is very
351
+ inconvenient in scripts. However, when logging in, we first try to store the
352
+ credentials in the keyring.
353
+
348
354
  """,
349
355
  )
350
356
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ladok3
3
- Version: 4.15
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.10,<2.0)
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,10 +1,10 @@
1
- doc/ltxobj/ladok3.pdf,sha256=Mpv9NyWe5m8WuVZVqHlknkYDROcHGrpMhj7r4ktLdVY,1415579
1
+ doc/ltxobj/ladok3.pdf,sha256=pBUZeoGiKAzEdNc1fHCfL8Krzxgj8essAbpglIfruYQ,1415370
2
2
  ladok3/.gitignore,sha256=QOcCshtjIsFasi4vaqFcooBWPJkxVWaoYEWOBBtdY_w,81
3
3
  ladok3/Makefile,sha256=Jy6OFjoVLU9YivnVxctxI_zrUOK9ysEOiistJ3ST6Nw,557
4
4
  ladok3/__init__.py,sha256=9bZ_ktF7mg8QvQZcdN3t2AzY_k7g-9Zm-pPh-edMB3Y,246543
5
5
  ladok3/api.nw,sha256=P5MQa3AqaUVv-xL3R-AHcFnBWTpAAvzfwlCDKoNFw-M,43422
6
- ladok3/cli.nw,sha256=SD75vD-uSn-0yo6aOIUY4lgx9EjQf4M-HPHFZrNHMG0,22449
7
- ladok3/cli.py,sha256=1oUlrI9N7ooGfB-pYt1rkCCX9YKatb4MwP9ivGniK00,12186
6
+ ladok3/cli.nw,sha256=sA5kevvAWBkzZHZ3UBkPEHoWvPw5yYtGYiPEnWMmjus,22864
7
+ ladok3/cli.py,sha256=6R7B0XVvYFlHcMbv6E73KOeI3ZGQFeQN2-ojz12H1vU,12555
8
8
  ladok3/data.nw,sha256=3o6-kmeMtCGoSJ5yL8qFCuIINQeym_WtW_2mhItuR-s,11785
9
9
  ladok3/data.py,sha256=kPRO9l5DTQb9lGnN2kU-YYPSyg31t0bq5HCw986hbPk,6747
10
10
  ladok3/ladok.bash,sha256=zGfTFdtos2zLjV13pzfK-1uCy2b_lF2qUKMoL2ExW7c,1441
@@ -14,8 +14,8 @@ ladok3/report.py,sha256=1K7cRaedemiOGDDAMI9wqnctLeic5ZlMYHw5hzhnvQw,5627
14
14
  ladok3/student.nw,sha256=zayn9_b9jCKeMnZxSGS_EuSmF3ojOBHQDMUMMkpRssI,3747
15
15
  ladok3/student.py,sha256=TaYn2rpbQnzummB-8xz-sUEV31Gh0CUmU0QkF6VgEic,1703
16
16
  ladok3/undoc.nw,sha256=NyHuVIzrRqJPM39MyAlZNEE7PbXdUDJFQ2kJ0NfdwQI,180333
17
- ladok3-4.15.dist-info/LICENSE,sha256=v8tr5LW7KHBDRqGt1qInr7_jhWrIlkVxO8EqOyrc7AE,1155
18
- ladok3-4.15.dist-info/METADATA,sha256=PvtIUzIvz06Hv0zKjmByrAZZgzBGERB3FH3e_yn1rDU,8826
19
- ladok3-4.15.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
20
- ladok3-4.15.dist-info/entry_points.txt,sha256=pi-KKP5Obo0AyuDjXQUpadS9kIvAY2_5ORhPgEYlJv8,41
21
- ladok3-4.15.dist-info/RECORD,,
17
+ ladok3-4.17.dist-info/LICENSE,sha256=v8tr5LW7KHBDRqGt1qInr7_jhWrIlkVxO8EqOyrc7AE,1155
18
+ ladok3-4.17.dist-info/METADATA,sha256=ZxruPVGrER8Mg-XfY0mqBc3ZKCgJdUZskeHcYtbfBlM,8826
19
+ ladok3-4.17.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
20
+ ladok3-4.17.dist-info/entry_points.txt,sha256=pi-KKP5Obo0AyuDjXQUpadS9kIvAY2_5ORhPgEYlJv8,41
21
+ ladok3-4.17.dist-info/RECORD,,
File without changes
File without changes