将curl命令转换为pycurl

杰基

我正在尝试将以下curl调用转换为pycurl,有人可以帮我解决这个问题吗?

curl --request 'POST' 'https://api.twitter.com/1.1/mutes/users/create.json' --data 'screen_name=fails' 
--header 'Authorization: OAuth oauth_consumer_key="mZRm27WsyGa8PRxcDC", oauth_nonce="5d10f384e1a8f176ca0a74b3dd2", oauth_signature="vYY%2BbHfXv1PTfc0MbY9jcLU%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1431346223", oauth_token="17718839-bewY3FfcV7vBPSd3pBOzscoxGmFeU", oauth_version="1.0"'
负反馈循环

是否可以在python中使用请求它更容易使用。这是一个小代码示例(不可运行):

 import requests
 import json

 myurl= 'https://api.twitter.com/1.1/mutes/users/create.json'
 to_post = {"label":"value"}
 to_post = json.dumps(to_post)  #Convert to json if that is the correct content-type
 r = requests.post(myurl,data = to_post , auth = ('username', 'password'))

pycurl中要复杂得多。需要更多行。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章