V
V
Viktor Kokorich2020-11-01 20:58:22
Python
Viktor Kokorich, 2020-11-01 20:58:22

Why does it return an empty list instead of uploading data?

There are no errors in the other part of the code, everything works.
get_html - using requests I send a request to the server
get_html - using bs I parse data

def parser():
    PAGENATION = int(input('Введите кол-во страниц: '.strip()))
    URL = input('Укажите ссылку на страницу банка: ').strip()
    html = get_html(URL)
    if html.status_code == 200:
        otzivi = []
        for page in range(1, PAGENATION):
            print(f'Спарсили страницу: {page}')
            html = get_html(URL, params = {'page':page})
            otzivi.extend(get_content(html.text))

        print(otzivi)

    else:
        print('Ошибка, проверьте соеденение с интернетом')

    
parser()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery Mamontov, 2020-11-02
@vmamontov

Viktor Kokorich good day!
perhaps the problem is in this line:
otzivi.extend(get_content(html.text))
- in the get_content() function - maybe html.get_text
() is correct ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question