【问题标题】:Python Citrix Sharefile Token Request giving 400 errorPython Citrix Sharefile 令牌请求给出 400 错误
【发布时间】:2022-06-21 21:00:35
【问题描述】:

我正在尝试发出一个简单的请求以从 Citrix ShareFile 获取访问令牌,但它会引发 400 错误。

我将完全按照文档中的说明进行操作,除了使用 HTTPLib 更改 Python2 代码,使用 Requests 更改 Python3 代码。代码是:

url = 'https://{my_domain}.sharefile.com/oauth/token'

headers = {'Content_Type': 'application/x-www-form-urlencoded'}
params = {'grant_type':'password', 'client_id':my_client_id, 'client_secret':my_client_secret, 'username':my_username, 'password':my_password}

response = requests.post(url, params=params, headers = headers)
print(response.status_code, response.reason)

我收到以下回复:

400 Bad Request

我还在参数中添加了 urllib.parse.urlencode,但仍然收到相同的响应错误

response = requests.post(url, params=urllib.parse.urlencode(params), headers = headers)

请求有关我做错了什么的指导。 TIA

【问题讨论】:

    标签: python python-requests citrix sharefile


    【解决方案1】:

    当我添加内容类型时,我的问题就解决了。

    检查并添加有效的内容类型

    【讨论】:

      猜你喜欢
      • 2016-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-21
      • 2023-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多