A
A
Anton2021-11-01 16:57:17
Python
Anton, 2021-11-01 16:57:17

How to get the contents of a pre tag in Python?

I wanted to parse the given url link to get the data from the tag, but unfortunately I couldn't do it this way:

def get_prices(url):
        response = requests.request(url=url method='GET')
        print(response.text)
        soup = bs(response.text, 'lxml')
        print(soup)


My output was this:
[]
<html><body><p>[]</p></body></html>


Please tell me what I'm doing wrong

The code in the comment to the answer

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SHADRIN, 2021-11-02
@goozzy

The whole problem is that when you request requests, you are not authorized in Steam and do not receive a response from it
. And when you open it through an authorized browser, you get a dictionary, so I recommend that you go through authorization or load cookies and everything will be fine

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question