且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Django中进行POST请求?

更新时间:2023-02-14 22:30:36

如果无法使用请求,请尝试使用urllib2和urllib. 您对此有何看法?

If you cannot use requests, try using urllib2 and urllib. What do you think about this?

post_data = {
  "username": "user",
  "password": "pass",
}
result = urllib2.urlopen('http://example.com', urllib.urlencode(post_data))
content = result.read()