Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
105 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Acquires a token by using application secret | ||
The following options are supported: | ||
- utilize built in GraphClient.with_client_secret(tenant, client_id, client_secret, scopes, token_cache) method | ||
- or provide a custom callback function to GraphClient constructor as demonstrated below | ||
https://learn.microsoft.com/en-us/entra/identity-platform/msal-authentication-flows#client-credentials | ||
""" | ||
import msal | ||
|
||
from office365.graph_client import GraphClient | ||
from tests import test_client_id, test_client_secret, test_tenant | ||
|
||
|
||
def acquire_token(): | ||
authority_url = "https://login.microsoftonline.com/{0}".format(test_tenant) | ||
app = msal.ConfidentialClientApplication( | ||
authority=authority_url, | ||
client_id=test_client_id, | ||
client_credential=test_client_secret, | ||
) | ||
return app.acquire_token_for_client(scopes=["https://graph.microsoft.com/.default"]) | ||
|
||
|
||
client = GraphClient(acquire_token) | ||
root_site = client.sites.root.get().execute_query() | ||
print(root_site.web_url) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class ResponseStatus(ClientValue): | ||
"""Represents the response status of an attendee or organizer for a meeting request.""" | ||
|
||
def __init__(self, response=None): | ||
""" | ||
:type response: str | ||
""" | ||
self.response = response |
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
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