-2

I repeated all the steps as in the tutorial but I don’t get the code. Although a couple of days ago everything worked

I write a simple code:

import requests
url = 'https://i-teka.kz/almaty/spisokaptek'
page = requests.get(url)
print(page.text)

and after running i get:

<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>

but should get the full html code I don't understand what the problem is

1

1 Answer 1

0

The may be checking for various headers. You can try various headers and find the required headers.

or

you can use a library I wrote called requestez which simplifies all this and does it automatically. you can do

pip install requestez

and then

import requestez
url = 'https://i-teka.kz/almaty/spisokaptek'
page = requestez.Session().get(url)
print(page)

image of output

part of the html of the page

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.