Home>

There is a website and you need to specify the date, place of departure, place of arrival of the client on it. I send data to the site, but when I try to get the page code after sending the data using the text method, the tag turns out to be empty, but if you go to the site, enter the data manually and look at the code, then the tag will contain data (table with flight schedules) . Here is my code

import requests
if __name__== '__main__':
    url= 'https://www.flyuia.com/ua/ru/information/flights-schedule#regular-timetable'
    query= {'city_from': 'Kyiv (KBP)',
             'city_to': 'Istanbul (IST)',
             'timetable_datepicker': '18.02.2022'}
    r= requests.post(url, params=query)
    print(r.status_code) # 200
    print(r.text)

r.json() have not been tried. The server response can be not only HTML, but also in the form of JSON

Сергей Шашко2022-02-14 21:48:13

When using json, a JSONDecodeError occurs

Dmitry2022-02-14 21:48:13

Are you sure you set the correct url for the post request? Request body?

Сергей Шашко2022-02-13 23:01:02

The URL is correct. You can go to the site, enter data from the dictionary in my code and look at the result of the query and at the source code of the table element (that's what I need ...)

Dmitry2022-02-14 07:57:40

Apparently you don't really understand how it all works. I advise you to try selenium. Yes, this site can work through a POST request, we get JSON as an output

Сергей Шашко2022-02-14 09:17:56