如何使用urllib2创建此SCIM协议请求

时间:2019-09-24 19:38:47

标签: python-2.7 urllib2

curl -k -v -X GET "https://scim-service:scim-port/scim/v4/Clients?filter=orgId%20eq%1111111111-1111-1111-1111-111111111111"

我想将上述curl请求转换为python请求

org_id = '1111111111-1111-1111-1111-111111111111'
params = urllib.urlencode({'filter' : 'orgId eq org_id'})
request = urllib2.Request(
            'https://scim-service:scim-port/scim/v4/Clients?', params)
response = urllib2.urlopen(request, context=ssl._create_unverified_context())

我在打印参数和请求时看到以下内容。 参数---> filter=orgId+eq+org_id 请求---> https://scim-service:scim-port/scim/v4/Clients?

我收到400错误请求。 如何使用urllib2将上述curl请求转换为Python请求?

0 个答案:

没有答案