POST not receiving correct response

十年热恋 提交于 2019-12-11 05:56:50

问题


I am trying to get the response(a table) with the help of urllib module of Python from this webpage:

http://www.mcxindia.com/SitePages/indexhistory.aspx

Here is what I have got:

import httplib 
import urllib 
import urllib2 
from BeautifulSoup import BeautifulSoup


headers = {

    'X-MicrosoftAjax':  'Delta=true',
'Cache-Control':    'no-cache',
'Content-Type':     'text/plain; charset=utf-8',
'X-Requested-With': 'XMLHttpRequest'

}

data = {
'ScrMgrIndexDetail':    'UpdatePanelIndexDetail|mBtnGo',
'__EVENTARGUMENT'   :   '',
'__EVENTTARGET'     :   '',
'__EVENTVALIDATION':    '/wEWEgKBwfDTAwKJ06rLCQKW06rLCQKI06rLCQKGvIClBQKI0rETAuPok+QNAt6H9c4HArme19MBAuaviJwKApqwna4EAob5psYNAra8t4YCAo735PEHAvONx9wNAsTJoJwMAqnggocCAqLS7ZwPLiXeyPcjUNNgk/21QgNaGP676o8=',
'__LASTFOCUS'   :       '',
'__VIEWSTATE'   :       '/wEPDwUJNDg3NDM2NDc0DxYOHgZuVG9rZW4CwwIeC3N0ckZyb21EYXRlBQowNy8yNS8yMDEzHglzdHJUb0RhdGUFCjA3LzMwLzIwMTMeDXNlbGVjdGVkSW5kZXgFCU1DWENPTURFWB4Nc29ydERpcmVjdGlvbgsqJ1N5c3RlbS5XZWIuVUkuV2ViQ29udHJvbHMuU29ydERpcmVjdGlvbgAeDWR0Q3VycmVudERhdGEysBkAAQAAAP////8BAAAAAAAAAAwCAAAATlN5c3RlbS5EYXRhLCBWZXJzaW9uPTIuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUBAAAAFVN5c3RlbS5EYXRhLkRhdGFUYWJsZQQAAAAZRGF0YVRhYmxlLlJlbW90aW5nVmVyc2lvbhhEYXRhVGFibGUuUmVtb3RpbmdGb3JtYXQJWG1sU2NoZW1hC1htbERpZmZHcmFtAwQBAQ5TeXN0ZW0uV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aXB0Ok9uSXRlbUNsaWNrKHRoaXMsICdtR3JkSGlzdG9yeScpHxcFG2phdmFzY3JpcHQ6T25Nb3VzZU91dCh0aGlzKRYSZg8PFgIfDQUKMDcvMjUvMjAxM2RkAgEPDxYCHw0FBzM4MjcuMDJkZAICDw8WAh8NBQczODI5LjY1ZGQCAw8PFgIfDQUHMzc4NC42NGRkAgQPDxYCHw0FBzM4MjMuODdkZAIFDw8WAh8NBQYmbmJzcDtkZAIGDw8WAh8NBQYmbmJzcDtkZAIHDw8WAh8NBQEtZGQCCA9kFgICAQ8PFgIfGAUYLi4vSW1hZ2VzL2Fycl9ta3Rkd24uZ2lmZGQCBQ8WAh8MZ2QCBw8WAh8MaGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFBm1CdG5Hb4tPAcW1DICwZS5enCGSBo6ZkKXC',
'mBtnGo.x':             '22',
'mBtnGo.y':             '1',
'mDdlOtherIndex':       '323',
'mRbtLstSpotFut':       '1',
'mTbFromDate':          '07/25/2013',
'mTbToDate':            '07/30/2013',
'txtSearch':    'search'
}

data = urllib.urlencode(data) 
#print data 
req = urllib2.Request('http://www.mcxindia.com/SitePages/indexhistory.aspx', data, headers) 
response = urllib2.urlopen(req)
the_page = response.read()

soup=BeautifulSoup(the_page)
print soup

The output that I get is :

61|pageRedirect||/Custom_Error.html?aspxerrorpath=/SitePages/indexhistory.aspx|

Where am I going wrong?


回答1:


Yes, just change the Content-Type key value.

'Content-Type':'text/plain; charset=utf-8'

Response content type is important in dynamic web pages.




回答2:


Response you are receiving is not a valid XML. BS not always can parse invalid XML. Wrap response with any xml tag and result will change.



来源:https://stackoverflow.com/questions/17942935/post-not-receiving-correct-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!