PyKubeGrader 0.2.17__py3-none-any.whl → 0.2.19__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {PyKubeGrader-0.2.17.dist-info → PyKubeGrader-0.2.19.dist-info}/METADATA +1 -1
- {PyKubeGrader-0.2.17.dist-info → PyKubeGrader-0.2.19.dist-info}/RECORD +7 -7
- pykubegrader/tokens/validate_token.py +14 -2
- {PyKubeGrader-0.2.17.dist-info → PyKubeGrader-0.2.19.dist-info}/LICENSE.txt +0 -0
- {PyKubeGrader-0.2.17.dist-info → PyKubeGrader-0.2.19.dist-info}/WHEEL +0 -0
- {PyKubeGrader-0.2.17.dist-info → PyKubeGrader-0.2.19.dist-info}/entry_points.txt +0 -0
- {PyKubeGrader-0.2.17.dist-info → PyKubeGrader-0.2.19.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,7 @@ pykubegrader/log_parser/parse.ipynb,sha256=H1CUuqiUSE-tiZV1IS7VG6HAEvoopGd6i_5QM
|
|
14
14
|
pykubegrader/log_parser/parse.py,sha256=YCs_OCnoxQKsL55MjTZWXBBBsehJL8PIB9ANnC-aE44,7379
|
15
15
|
pykubegrader/submit/submit_assignment.py,sha256=p-v31479342q0AO3lJrd8Fwk7iJQUz183OeGeiNcXOY,3405
|
16
16
|
pykubegrader/tokens/tokens.py,sha256=DorNwdrA5N5apB3LQjVGa2ABN5C1upkgglecaLHobr0,1260
|
17
|
-
pykubegrader/tokens/validate_token.py,sha256=
|
17
|
+
pykubegrader/tokens/validate_token.py,sha256=QV_xWKsWowBHzmLEAFe-D_gficYvg2jSBGEnBvpoL8c,2115
|
18
18
|
pykubegrader/widgets/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
19
19
|
pykubegrader/widgets/multiple_choice.py,sha256=NjD3-uXSnibpUQ0mO3hRp_O-rynFyl0Dz6IXE4tnCRI,2078
|
20
20
|
pykubegrader/widgets/reading_question.py,sha256=y30_swHwzH8LrT8deWTnxctAAmR8BSxTlXAqMgUrAT4,3031
|
@@ -27,9 +27,9 @@ pykubegrader/widgets_base/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-
|
|
27
27
|
pykubegrader/widgets_base/multi_select.py,sha256=Cl0IN21wXLZuFu-zC65aS9tD4jMfzCRJ2DPjHao5_Ak,4044
|
28
28
|
pykubegrader/widgets_base/reading.py,sha256=_vjUPynqmJe_R4vf-7hVhGnQR726S9GL6qT8bflBXBM,5383
|
29
29
|
pykubegrader/widgets_base/select.py,sha256=Fw3uFNOIWo1a3CvlzSx23bvi6bSmA3TqutuRbhD4Dp8,2525
|
30
|
-
PyKubeGrader-0.2.
|
31
|
-
PyKubeGrader-0.2.
|
32
|
-
PyKubeGrader-0.2.
|
33
|
-
PyKubeGrader-0.2.
|
34
|
-
PyKubeGrader-0.2.
|
35
|
-
PyKubeGrader-0.2.
|
30
|
+
PyKubeGrader-0.2.19.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
|
31
|
+
PyKubeGrader-0.2.19.dist-info/METADATA,sha256=wPPKPTXgCW6_bOgG8J7r9nFFi9SOCTPJAvJR5rk8DB4,2779
|
32
|
+
PyKubeGrader-0.2.19.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
|
33
|
+
PyKubeGrader-0.2.19.dist-info/entry_points.txt,sha256=UPMdTT46fQwTYJWtrUwIWIbXbwyOPfNQgBFRa0frWzw,138
|
34
|
+
PyKubeGrader-0.2.19.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
|
35
|
+
PyKubeGrader-0.2.19.dist-info/RECORD,,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import requests
|
2
|
-
|
2
|
+
import os
|
3
3
|
|
4
4
|
class TokenValidationError(Exception):
|
5
5
|
"""
|
@@ -16,7 +16,7 @@ class TokenValidationError(Exception):
|
|
16
16
|
super().__init__(message)
|
17
17
|
|
18
18
|
|
19
|
-
def validate_token(token):
|
19
|
+
def validate_token(token = None):
|
20
20
|
"""
|
21
21
|
Validate a token by making a GET request to the validation endpoint.
|
22
22
|
|
@@ -29,7 +29,19 @@ def validate_token(token):
|
|
29
29
|
Returns:
|
30
30
|
None: If the token is valid, the function will pass silently.
|
31
31
|
"""
|
32
|
+
# sets the token in the environment variable
|
33
|
+
if token is not None:
|
34
|
+
os.environ["TOKEN"] = token
|
35
|
+
|
36
|
+
if token is None:
|
37
|
+
token = os.getenv("TOKEN", None)
|
38
|
+
|
39
|
+
if token is None:
|
40
|
+
raise TokenValidationError("No token provided")
|
41
|
+
|
42
|
+
# Define the validation endpoint
|
32
43
|
endpoint = f"https://engr-131-api.eastus.cloudapp.azure.com/validate-token/{token}"
|
44
|
+
|
33
45
|
try:
|
34
46
|
response = requests.get(endpoint, timeout=10)
|
35
47
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|