没有一般的refresh_token en txt python-O365

时间:2019-01-17 19:37:58

标签: python o365-flow

我可以使用python或python进行通用的帐户访问。con.request_token(result_url)不能刷新,也可以简化访问权限,方便

from O365 import Account

scopes_graph = protocols.get_scopes_for('message_send')
credential = ('client_id', 'client_secret')

account = Account(credentials=credential, scopes=scopes_graph)
account.con.get_authorization_url()
result_url = input('Paste the result url here...')
#'aqui crea el txt pero no genera el 
account.con.request_token(result_url) 
m = account.new_message() 
m.to.add('examples@example.com')
m.subject = 'Testing!'
m.body = "George Best quote: I've stopped drinking, but only while I'm asleep."
m.send()

necesito el“ refresh_token”:“ ....” gracias

1 个答案:

答案 0 :(得分:1)

仅需使用:

为此:

account = Account(credentials=credential, scopes=scopes_graph)
account.con.get_authorization_url()
result_url = input('Paste the result url here...')
#'aqui crea el txt pero no genera el 
account.con.request_token(result_url)

通过此代码

account = Account(credentials=credential, scopes=scopes_graph)
account.authenticate(scopes=['basic', 'message_all'])