Python (Post) submit a form -


i teaching myself submitting form on web

but somehow post not working.

the url https://courselist.wm.edu/courselist/

and code far is:

from bs4 import beautifulsoup import requests import urllib import re  url = 'http://courselist.wm.edu/courselist' requests.session() session:     response = session.get(url)    soup = beautifulsoup(response.content)     data = {       'term_code' : '201530',       'term_subj' : 'afst',       'attr' : '0',       'levl' : '0',       'status' : '0'    }     r = session.post(url, data=data)     #response = session.post(url, data=data)    print r.content    #soup = beautifulsoup(response.content)     #for row in soup.select('table'):      # print [td.text td in row.find_all('td')] 

you cannot submit form beautifulsoup. should use mechanize. see here example of how use form submitting.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -