views:

24

answers:

0

Hi, I new using python + webkit.

I need make a POST request with webkit, but I dont know how to it.

I use python-webkit because my app load a form on the GUI (for vote, comments and send more data) and I need post all these data with a POST request and load the html result send for the server to my GUI app with python-webkit.

I have only this example with urllib:

#!/usr/bin/python

import urllib2, urllib
import httplib

server = 'server.somesite.com'
data = {'name' : 'shakaran', 'password' : 'Only_I_know'}
d = urllib.urlencode(data)
headers = {"Content-type": "application/x-www-form-
urlencoded",
"Accept": "text/plain"}
conn = httplib.HTTPConnection(server)
conn.request("POST", "/login.php", d, headers)
response = conn.getresponse()
if response.status == 200:
   print response.status, response.reason
   print response.getheaders()
   data = response.read()
   print data
conn.close()

I need a simple example with webkit. I look in the documentation for Webkit.HTTPRequest http://www.webwareforpython.org/WebKit/Docs/Source/Docs/WebKit.HTTPRequest.html

I try with webkit.NetworkRequest() but I don't know how to it.

Some help? Thanks