Here is my code:
import requests
find_doctors_url = 'http://www.americhoice.com/find_doctor/Ver2/results_doc.jsp'
payload ={"specialty":"ORSU","docproducts":"HOBD,HLOP","planNameDropDoc":"HOBD,HLOP","plan":"uhcwa","zip":"98122","zipradius":"10","findButton":"FIND DOCTOR","specialtyName":"ORTHOPAEDIC SURGERY"}
response = requests.get(find_doctors_url,params=payload)
print(response.url)
print(response.content)
when I print response.content, all I receive is:
<!-- NEAADR0179 -Anil Kumar Vutikuri *** End-->
<!--BEGIN SETTING HEADERS TO NO CACHE-->
<!--END SETTING HEADERS TO NO CACHE-->
<!--SET SESSION VALUES FROM URL PARAMETERS-->
<!--END SET SESSION VALUES FROM URL PARAMETERS-->
Which is the response you receive when you navigate to: view-source:http://www.americhoice.com/find_doctor/Ver2/results_doc.jsp
However, I am seeking to return the complete html received when you navigate to the url generated by response.url
The problems seems to be that the request is not sending the GET query params correctly
Things I have tried (unsuccessfully): 1)Requesting the complete URL(encoded) instead of using a params dictionary 2)Using the urllib3 library instead of the Requests library
First, the view-source website you give returns 404 error.
Second, what do you get when you print response.url
? It should return full url including params
concatenated.