Python请求模块:相当于cURL--data命令

Python请求模块:相当于cURL--data命令,python,python-requests,urllib,urlencode,Python,Python Requests,Urllib,Urlencode,我正在尝试编写一个脚本,模仿我为更改目标网页上的数据而执行的cURL命令: curl -u username:password "https://website.com/update/" --data "simChangesList=%5B%7B%22simId%22%3A760590802%2C%22changeType%22%3A2%2C%22targetValue%22%3A%220003077%22%2C%22effectiveDate%22%3Anull%7D%5D" --compr

我正在尝试编写一个脚本,模仿我为更改目标网页上的数据而执行的cURL命令:

curl -u username:password "https://website.com/update/"  --data "simChangesList=%5B%7B%22simId%22%3A760590802%2C%22changeType%22%3A2%2C%22targetValue%22%3A%220003077%22%2C%22effectiveDate%22%3Anull%7D%5D" --compressed
正如您在上面看到的,我正在向目标网页发布一个url编码字符串

以下代码不起作用:

import requests
import urllib

enc = urllib.quote('[{"simId":760590802,"changeType":2,"targetValue":000307,"effectiveDate":null}]')
simChangesList = 'simChangesList=' + enc
print simChangesList
auth = s.post(url, data=simChangesList)
print auth.text
尽管我相当肯定上面的代码以前模仿了我的cURL命令,但显然不是

我得到一个
必需的列表参数'simChangesList'不存在
错误

在Python中,cURL命令与requests模块发布url编码的字符串的等效性是什么

编辑:

我曾经尝试过以simChangesList为键制作多个词典,但我似乎做不到

以下是我的尝试:

simChangesList: [{"simId":760590802,"changeType":2,"targetValue":000307,"effectiveDate":null}]

data = {'simChangesList': ['simId': 760590802, 'changeType': 2, 'targetValue': '0003077', 'effectiveDate': null]}
data['simChangesList'] = ['simId': 760590802, 'changeType': 2, 'targetValue': '0003077', 'effectiveDate': null]
simChangesList:[{"simId":760590802,"changeType":2,"targetValue":"000307","effectiveDate":null}]

payload = {
'simChangesList':
[{'simId': '760590802',
'changeType': '2',
'targetValue': '0003077',
'effectiveDate': 'null'}]
}

您需要一本带有
simChangesList
作为key@cricket_007如何向一个主密钥添加多个密钥/值?我已经试了很久了,但我似乎没能做对。你说你试了多久@几天的板球比赛,哇,我对你的链接感激不尽!非常感谢!!酷。请随意发布您自己的问题答案。您需要一本以
simChangesList
为主题的词典key@cricket_007如何向一个主密钥添加多个密钥/值?我已经试了很久了,但我似乎没能做对。你说你试了多久@几天的板球比赛,哇,我对你的链接感激不尽!非常感谢!!酷。请随意发布您自己的问题答案