Skip to content

Commit

Permalink
Merge pull request #29 from cern-vc/develop
Browse files Browse the repository at this point in the history
🚀 RELEASE: Bump to 2.0.2
  • Loading branch information
SamuelGuillemet authored Aug 21, 2023
2 parents 5ea674b + 367fe9a commit 76c0d38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions ms_python_client/ms_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ def __init__(
config: Config,
api_endpoint: str = "https://graph.microsoft.com/v1.0",
):
if "MS_ACCESS_TOKEN" in os.environ and os.getenv("MS_ACCESS_TOKEN") != "":
self.dev_token = os.environ["MS_ACCESS_TOKEN"]
else:
self.dev_token = None
self.oauth = Oauth2Flow(config)

self.api_client = ApiClient(api_base_url=api_endpoint)
self.oauth = Oauth2Flow(config)
self.init_components()

def build_headers(self, extra_headers: Optional[_Headers] = None) -> _Headers:
if "MS_ACCESS_TOKEN" in os.environ and os.getenv("MS_ACCESS_TOKEN") != "":
token = os.environ["MS_ACCESS_TOKEN"]
if self.dev_token:
token = self.dev_token
else:
token = self.oauth.get_access_token()[0]

Expand Down
1 change: 1 addition & 0 deletions ms_python_client/utils/event_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class PartialEventParameters(OptionalTimezone, TypedDict, total=False):
end_time: str


# This has been set arbitrarily
ZOOM_ID_EXTENDED_PROPERTY_ID = (
"String {d3123b00-8eb5-4f10-ae88-1269fe4cbaf0} Name ZoomId"
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ms-python-client"
version = "2.0.1"
version = "2.0.2"
exclude = ["tests*", "example*", ".github*", ".git*", ".vscode*"]
description = "This package is used to interact with the microsoft graph API"
authors = ["Samuel Guillemet <[email protected]>"]
Expand Down
1 change: 0 additions & 1 deletion tests/ms_python_client/test_ms_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def test_build_headers_with_extra_headers(self):
assert headers["Authorization"] == f"Bearer {MOCK_TOKEN}"
assert headers["test"] == "test"

@mock_msal()
def test_with_token(self):
os.environ["MS_ACCESS_TOKEN"] = "test_token"
client = MSApiClient.init_from_dotenv(custom_dotenv=self.env_file)
Expand Down

0 comments on commit 76c0d38

Please sign in to comment.