我已经导入了图形,知道为什么它不能识别属性吗?
def display_access_token(graph: Graph): token = graph.get_user_token() print('User token:', token, '\n') if user_input == '0': display_access_token(graph)
我不知道该怎么做才能解决它。提前感谢。
1szpjjfi1#
我已经参考了official documentation的示例代码。在我这边复制之后,在graph.py中添加get_user_token()之后,这是工作正常的。下面是我的graph.py中的完整代码。
get_user_token()
import json from configparser import SectionProxy from azure.identity import DeviceCodeCredential, ClientSecretCredential from msgraph.core import GraphClient class Graph: settings: SectionProxy device_code_credential: DeviceCodeCredential user_client: GraphClient client_credential: ClientSecretCredential app_client: GraphClient def __init__(self, config: SectionProxy): self.settings = config client_id = self.settings['clientId'] tenant_id = self.settings['authTenant'] graph_scopes = self.settings['graphUserScopes'].split(' ') self.device_code_credential = DeviceCodeCredential(client_id, tenant_id = tenant_id) self.user_client = GraphClient(credential=self.device_code_credential, scopes=graph_scopes) def get_user_token(self): a="Return from get_user_token" return a
1条答案
按热度按时间1szpjjfi1#
我已经参考了official documentation的示例代码。在我这边复制之后,在graph.py中添加
get_user_token()
之后,这是工作正常的。下面是我的graph.py中的完整代码。