python - Unable to access AJAX url with requests, BeautifulSoup -


i trying read data of table, onclick ajax event of following webpage

the event initiates if click + sign right of tabelas tab, @ bootom of page.

using firebug (for example) browser y can optain ajax url xhr tab of net section.

the url valid , browser picks , shows it.

my script:

 import requests   urls="http://www.hidrografico.pt/components/com_products/scripts/server/data_getestactable.php"   headers = { 'user-agent':'mozilla/5.0 (x11; ubuntu; linux x86_64; rv:39.0) gecko/20100101 firefox/39.0', 'accept': 'application/json, text/javascript, */*; q=0.01', 'content-type': 'application/x-www-form-urlencoded; charset=utf-8', 'x-requested-with': 'xmlhttprequest'  }   s = requests.session()  s.post(urls)   content = s.post(urls, headers=headers)   print content.content 

the output gives:

direct access file prohibited. 

so seems there no direct access url although if paste url in browser can see table, in source code.

i dont know if missing or page in blocks direct attempt of readinig.

i tried through main webpage access table using beautifulsoup(text) , blabla.find(class,{'id':blabla}) , blabla.findall() gives

attributeerror: 'nonetype' object has no attribute 'findall' 

because de attribute class 'find' finds nothing.

i appreciate kind of , guidance tackle hurdle.

if check post parameters find need send estid=4&param=1 , work if have right cookies can sending get requests front page.

import requests   # prepare session store cookies. s = requests.session() # cookies s.get("http://www.hidrografico.pt/boias-ondografo.php")  table_url = "http://www.hidrografico.pt/components/com_products/scripts/server/data_getestactable.php"     # prepare parameters payload = { "estid": "4",         "param": "1"          } r = s.post(table_url, data=payload) print r.text 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -