By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

on posting form data to a site, getting default response only

P: 1
I want to get a response from a site by posting a form data programmatically using Python 3.4.2 (to avoid boring task of obtaining data (about 2400 times) through std.Browser. Following code works (?) but not for the posted data but a default response obtained.

Expand|Select|Wrap|Line Numbers
  1. # Python 3.4.2
  2. # Request for posting data is it OK ?
  3. # Response for only default data received
  4. import urllib.request
  5. import urllib.parse
  6. url = 'http://www.xxx.php?dd=14'    
  7. headers={}
  8. headers['User-Agent'] = "Mozilla/5.0 xxx'
  9. # header added to dupe server to indicate source 
  10. # of request as a Standard browser
  11. req = urllib.request.Request(url , headers = headers)
  12. #print(req)  
  13. respon = urllib.request.urlopen(req)
  14. # print(len(resp)) 
  15. print(respon.status)
  16. resp = respon.read()
  17.  
Can any body help me?
Apr 26 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.