Skip to content

Commit

Permalink
Merge pull request #20 from edanalytics/feature/optional_api_mode
Browse files Browse the repository at this point in the history
Make api_mode optional
  • Loading branch information
jayckaiser authored Jan 30, 2024
2 parents 31647ec + 33f4f82 commit efe2d1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions edfi_api_client/edfi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __repr__(self):
(Un)Authenticated Ed-Fi(2/3) Client [{api_mode}]
"""
_session_string = "Authenticated" if self.session else "Unauthenticated"
_api_mode = util.snake_to_camel(self.api_mode)
_api_mode = util.snake_to_camel(self.api_mode) if self.api_mode else "None"
if self.api_year:
_api_mode += f" {self.api_year}"

Expand Down Expand Up @@ -129,14 +129,14 @@ def get_info(self) -> dict:
return requests.get(self.base_url, verify=self.verify_ssl).json()


def get_api_mode(self) -> str:
def get_api_mode(self) -> Optional[str]:
"""
Retrieve api_mode from the metadata exposed at the API root.
:return:
"""
api_mode = self.get_info().get('apiMode')
return util.camel_to_snake(api_mode)
return util.camel_to_snake(api_mode) if api_mode else None


def get_ods_version(self) -> Optional[str]:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name='edfi_api_client',
version='0.2.0',
version='0.2.1',
description='Ed-Fi API client and tools',
license_files=['LICENSE'],
url='https://github.com/edanalytics/edfi_api_client',
Expand Down

0 comments on commit efe2d1f

Please sign in to comment.