Skip to content

Commit

Permalink
Don't crash if enhanced API key is not set
Browse files Browse the repository at this point in the history
Also, updating version to 0.3.0.
  • Loading branch information
PasiSa committed Dec 20, 2021
1 parent 8501835 commit d5f3339
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion aalto_sisu/sis_aalto.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ def get_instances(self, course: str) -> List[Tuple[str, str]]:

def request_from_enhanced_api(self, id: str) -> dict:
url=f"{settings.AALTO_SISU_URL_PREFIX}/courseunitrealisations-enhanced?id={id}&USER_KEY={settings.AALTO_SISU_API_KEY}"
headers = {"X-ApiKey":str(settings.AALTO_SISU_ENHANCED_API_KEY)}
if hasattr(settings, 'AALTO_SISU_ENHANCED_API_KEY'):
headers = {"X-ApiKey":str(settings.AALTO_SISU_ENHANCED_API_KEY)}
else:
headers = {"X-ApiKey":""}
response = requests.get(url, headers=headers, timeout = HTTP_REQUEST_TIMEOUT)
response.raise_for_status()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name='aalto-sisu',
version='0.2.0',
version='0.3.0',
description='Aalto-SISU plugin for A+ LMS',
long_description=long_description,
keywords='django',
Expand Down

0 comments on commit d5f3339

Please sign in to comment.