Getting Value from Response from Requests on python -
i using requests , i'm trying response (as seen on network tab on chrome)
url = r"https://wwww.mylocal.com/345523" authkey = base64.b64encode("testu:pwd$u") headers = {"content-type":"application/json", "authorization":"basic " + "ywrtaw46owjktmp5wuxkc1a0dlj1dtd2mk0"} data = { "id":444} r = requests.get(url, headers=headers, params = data) print r.content
but keep getting html of page , want actual response. when using r.content
message object cannot decoded, makes sense since r.content
retrieves source code instead of actual response. there way that? response see on network tab similar to:
{"search_results": {"@xmlns": "http://mylocal.com/345523", "colorsinfo": {"bgcolor": "552448"}}
and want retrieve value of bgcolor
on r.content
html content of page.
<!doctype html> <html> <head> <meta charset="utf-8"> ...and on
my first guess think getting login form because have not logged site.
can verify case reading through html or writing html file , opening in browser.
if suspicions correct @ requests session object (http://docs.python-requests.org/en/latest/user/advanced/), post username , password via form in browser , request data above.
Comments
Post a Comment