用urllib2指定请求方法?
此代码生成一个 POST 请求:
urllib2.urlopen("http://somedomain.com/", data)
我想生成一个 GET 请求 - 关于如何做到这一点有什么想法吗?
感谢您的帮助!
This code produces a POST request:
urllib2.urlopen("http://somedomain.com/", data)
I would like to produce a GET request - any ideas on how to do that?
Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
[编辑]
如果您想在正文中发送 xml/json/etc 数据,请使用类似以下内容:
这将使用 POST 方法,但任何“GET”参数也将可供您的应用程序使用。
Try:
[edited]
If you want to send xml/json/etc data in the body, use something like:
This will use the POST method, but any "GET" parameters will also be available to your application.
或者,您还可以使用具有更明确 API 的
requests
:发出 GET 请求:
发帖请求:
Alternatively, you also use
requests
that has a more explicit API:Make a GET request:
Make a POST request: