use Python for http POST requests
» Articles / Code » Scripts » use Python for http POST requests
A little script that shows how to use Python for HTTP Requests
import string,urllib
def format(items):
list = []
for k, v in items:
list.append("%s=%s" % (k, urllib.quote_plus(v)))
return string.join(list, '&')
data = { 'hidd':'en', 'email':'you at yourmail.com',
'POST':'post.gif' }
d = format(data.items())
try:
sock = urlopen(YourURL, d)
for l in sock.readlines():
print l
sock.close()
finally:
urlcleanup()
Post your comment
Comments
No one has commented on this page yet.
RSS feed for comments on this page | RSS feed for all comments