PyKubeGrader 0.2.17__tar.gz → 0.2.19__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pykubegrader-0.2.17/src/PyKubeGrader.egg-info → pykubegrader-0.2.19}/PKG-INFO +1 -1
- {pykubegrader-0.2.17 → pykubegrader-0.2.19/src/PyKubeGrader.egg-info}/PKG-INFO +1 -1
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/tokens/validate_token.py +14 -2
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/.coveragerc +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/.github/workflows/main.yml +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/.gitignore +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/.readthedocs.yml +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/AUTHORS.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/CHANGELOG.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/CONTRIBUTING.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/LICENSE.txt +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/README.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/Makefile +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/_static/custom.css +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/authors.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/changelog.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/conf.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/contributing.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/index.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/license.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/readme.rst +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/docs/requirements.txt +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/examples/.responses.json +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/examples/true_false.ipynb +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/pyproject.toml +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/setup.cfg +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/setup.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/PyKubeGrader.egg-info/SOURCES.txt +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/PyKubeGrader.egg-info/requires.txt +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/__init__.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/build/__init__.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/build/api_notebook_builder.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/build/build_folder.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/build/clean_folder.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/graders/__init__.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/graders/late_assignments.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/initialize.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/log_parser/__init__.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/log_parser/parse.ipynb +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/log_parser/parse.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/submit/submit_assignment.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/telemetry.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/tokens/tokens.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/utils.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/validate.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/__init__.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/multiple_choice.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/reading_question.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/select_many.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/student_info.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/style.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/true_false.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets/types_question.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets_base/__init__.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets_base/multi_select.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets_base/reading.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/src/pykubegrader/widgets_base/select.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/tests/conftest.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/tests/import_test.py +0 -0
- {pykubegrader-0.2.17 → pykubegrader-0.2.19}/tox.ini +0 -0
@@ -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
|
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
|
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
|