Попытка получить доступ к этому URL после входа в систему:
https://formularylookup.com/Formulary/Coverage?ProductId=237171&ProductName=Rybelsus&ChannelId=2&DrugTypeId=3&StateId=all&Options=SummaryCoverages
Несмотря на то, что код состояния в Chrome Проверка показывает 200, я не могу получить к нему доступ через Chrome или Python.
url_2="https://formularylookup.com/Formulary/Coverage?ProductId=237171&ProductName=Rybelsus&ChannelId=2&DrugTypeId=3&StateId=all&Options=SummaryCoverages"
#url = "https://formularylookup.com"
params = {
"ProductId":"237171",
"productSearch":"Rybelsus"}
headers = {
#"authorization":"Bearer 1VR8DfgVSrPvGXVJ5nca4kagi3aRg-Ug",
"Access-Token":"1VR8DfgVSrPvGXVJ5nca4kagi3aRg-Ug",
#"Accept": "*/*",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
"Host": "formularylookup.com",
"X-NewRelic-ID": "XAYCVFZSGwcGU1lXBAI="
}
res = requests.get(url_2, headers=headers, params = params)
soup = BeautifulSoup(res.content, "lxml")
#fix = json.loads(res)
#s = soup.find("input", {"id":"productSearch"})
print(res.content)
Я могу легко подключиться к URL, но url_2 вызывает у меня проблемы в Python.
В чем проблема?
РЕДАКТИРОВАТЬ: При проверке после входа в На сайте, я ясно вижу, для url_2, что есть данные:
{ControllerCoverages: [,…], PlanCoverages: null,…}
ControllerCoverages: [,…]
PlanCoverages: null
SummaryCoverages: [{UnifiedTierId: 5, Percentage: 0, Lives: 212787, PlanCount: 10, Name: "Preferred",…},…]
FormularyCoverages: null
VarianceCoverages: null
Statement: "Rybelsus has Unrestricted Access for 26% of Commercial lives in All Locations"
FormularyCount: 0
И это то, что можно увидеть в разделе Заголовки-> Параметры строки запроса, но не уверен, что это еще полезно:
ProductId: 237171
ProductName: Rybelsus
ChannelId: 1
DrugTypeId: 3
StateId: all
Options: SummaryCoverages