-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Authress/resolve-package-version
Resolve the package version in all http calls.
- Loading branch information
Showing
4 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# flake8: noqa | ||
|
||
from authress.utils.jwt_manager import JwtManager | ||
from authress.utils.package_version_provider import PackageVersionProvider | ||
from authress.utils.service_client_token_provider import ServiceClientTokenProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
|
||
class PackageVersionProvider: | ||
def __init__(self): | ||
self.version = None | ||
|
||
def get_version(self): | ||
if self.version is None: | ||
try: | ||
this_directory = os.path.abspath(os.path.dirname(__file__)) | ||
with open(os.path.join(this_directory, '..', 'VERSION')) as version_file: | ||
self.version = version_file.read().strip() | ||
except Exception as e: | ||
return 'InvalidPackageVersion' | ||
|
||
return self.version | ||
|