javascript - JSON post using Python requests -


i using python 2.7 on windows 7 requests requests module.

i trying find source of data website uses ajax/javascript drive events.

here python post:

result = s.post(url, headers = {'referer': my_referer}) 

the output post looks this:

{"adata":{"count":0.0,"aitem":[]},"wm":0.0,"cm":0.0,"pc":"","pw":"","nc":14,"rr":false,"rtime":{"ritem":[],"count":0.0},"wc":1.0,"cc":1.0,"rw":false,"ra":false,"rc":true}  

"aitem":[] should populated data i'm after see not. rc: should false. or @ least when go through browser

note "ra":true , "rc":false if use instead of post request. dont know why.

here corresponding post in javascript server side:

$.getjson (url, function(data){updatestuff(data);}); 

disclaimer: have been programming week now.

this json post in function receives no parameters , returns nothing far can tell. data not referenced in function prior post. dont understand function(data) is. updatestuff(data) function bunch of code takes data , returns nothing. code reveals stuff data structure references such as:

if (data.ra){resetal();} else { if (data.rr ){objar.attr('ref','y');} if (data.rc ){objac.attr('ref','y');} if (data.rw ){objaw.attr('ref','y');} 

which guess failing logic gate since data different see in successful browser request.

and references data.adata.count , data.adata.aitem[i] etc

i've been told simpler write in js have 70% of program done in python , i've never used js.

any appreciated.


Comments

Post a Comment

Popular posts from this blog

c# - Where does the .ToList() go in LINQ query result -

Listeners to visualise results of load test in JMeter -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -