The site doesn't appear in python requests -


check code below, think there wrong cookie because when pass browser's cookie works.

import requests  header = {             'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',             'accept-encoding':'gzip, deflate, sdch',             'accept-language':'en-us,en;q=0.8',             'cache-control':'max-age=0',             'connection':'keep-alive',             'host':'secure.in.gov',             'content-length':'6917',             'upgrade-insecure-requests':'1',             'user-agent':'mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/45.0.2454.101 safari/537.36',           }  requests.session() session:      session.get("https://secure.in.gov/sos/online_corps/name_search.aspx",headers=header,verify=true)      session.cookies['__utma'] = '58136434.1826530329.1443539661.1443539661.1443539661.1'     session.cookies['__utmc'] = '58136434'     session.cookies['__utmz'] = "58136434.1443539661.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"     session.cookies['_ga'] = 'ga1.2.1826530329.1443539661'     session.cookies['__qca'] = 'p0-2058828605-1443539662643'     session.cookies['_baga'] = 'ga1.2.1826530329.1443539661'      session.get("https://secure.in.gov/sos/online_corps/name_search_results.aspx?search_name=aa&search_type=exact&client_id=&submit.x=23&submit.y=6&submit=submit&search_mode=search",headers=header,verify=true)      reponse = session.get("https://secure.in.gov/sos/online_corps/view_details.aspx?guid=e5d19da1-9e31-4758-9656-5bc54f43f972",headers=header,verify=true)      print(reponse.content) 

i think cookie of website changing. should use cookiejar handle cookies.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -