我尝试在Python中使用wrikeapi。我无法获取访问令牌。我对通过API的ouath2很陌生,所以不确定我哪里出错了,任何帮助都是非常感谢的
import json
import os
import requests
import time
import logging
from time import localtime, strftime
wrike_url = "https://wrike.com/"
wrike_user = "username"
wrike_password = "password"
wrike_clientId = "clientid"
wrike_clientSecret = "secret"
logging.basicConfig(level=logging.INFO, format='%(message)s')
logger = logging.getLogger()
logger.addHandler(logging.FileHandler('wrike-log.log', 'a'))
print = logger.info
def wrike_test():
code = requests.get(wrike_url+"oauth2/authorize?client_id="+wrike_clientId+"&response_type=code")
print(code.status_code)
token_url = wrike_url+"oauth2/token/"
access_token = requests.post(token_url, data = {'client_id' : wrike_clientId,
'client_secret' : wrike_clientSecret,
'grant_type' : 'authorization_code',
'code' : str(code.status_code)
})
def main():
wrike_test()
main()
我得到一个404错误。在
无法标记wrike,因为它需要更多的重复
首先检查服务是否存在,并且您正在生成所需的URL。在
将打印的结果粘贴到浏览器中,以检查您是否得到了预期的响应,然后再责怪您的代码。在
在网上读了一段时间后,我找到了一个更简单的方法。这个方法需要你有一个永久性的令牌,这个令牌可以在设置wrike应用程序时获得。在
相关问题 更多 >
编程相关推荐