Home>
Hello everyone. When writing a fileindex.html
, a block of html code withid="app"
does not parse. Tell me what could be the problem?
Python code
import requests
from fake_useragent import UserAgent
def main():
session= requests.Session()
ua= UserAgent()
headers= {
"accept": "*/*",
"user-agent": ua.chrome
}
data= {
"login": "***My login***",
"password": "***My password***"
}
url= "https://netology.ru/profile"
link= "https://netology.ru/backend/api/user/sign_in"
session.headers.update(headers)
res= session.post(link, data=data, headers=headers)
print(res) # <Response[200]> profile_info= session.get(url, headers=headers).text
with open("index.html", "w") as file:
file.write(profile_info)
if __name__== "__main__":
main()
A piece of html code from the recorded fileindex.html
<body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PWG78J" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div id="app"></div><script type="text/javascript">
@fedor.chernolutsky tried your advice, didn't help. Throws AttributeError: 'Response' object has no attribute 'get'. res doesn't have a get method.
GRuler2022-01-19 10:06:46Related questions
- How to enter captcha in vk python
- Python Beautifulsoup How to get link from tag?
- How to remove { } : " " elements and letters U S D. All this must be done in python
- python. Get the value of the Phone field
- How does the server know to distinguish between a python-requests request and a Fiddler request?
- python : Why is the result not displayed?
- How to get data-value from td in BS4 python
- python : Maximum Dictionary Size
- python : requests doesn't return what the browser returns
- python : extends 'base.html' not working on hosting
Maybe in the end you need to work not with session, but with res ?
fedor.chernolutsky2022-01-18 19:57:19