Hướng dẫn python web scraping timeout

import requests

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'
}

params = {
    'sort': 'dd',
    'filter': 'reviews-dd',
    'res_id': 18439027
}


def main(url):
    with requests.Session() as req:
        for page in range(1, 11):
            print(f"{'*' * 30} Extracting Page# {page} {'*' * 30}")
            params['page'] = page
            r = req.get(url, params=params, headers=headers).json()
            for x in r['entities']['REVIEWS'].values():
                print("Username: {:<20}, Comment: {}".format(
                    x['userName'], x['reviewText']))


main("https://www.zomato.com/webroutes/reviews/loadMore")

Output:

****************************** Extracting Page# 1 ******************************
Username: Nitisha Dwivedi     , Comment: I tried veg manchurian, veg noodles, pasta arrabiata, virgin mojito from sky hilton and the food was great, freshly cooked, very tasty and well presented. The waiters were attentive and service was overall good but some of the waiters are rude even. I would suggest you to come to this place and enjoy food!
Username: Sakshi Jaiswal      , Comment: this place is lovely rocking
the party place
best saturday place
live music great taste

Username: Atul , Comment: They send me gravy chicken while I ordered tava chicken listed under DRY snacks and beforehand informed Mr. Dinesh Dixit as well about the order.But this is what I received. Gravy can be clearly seen with Oil spilling all over. When I informed ZOMATO and the manager about it, ZOMATO said they will give the feedback to the restaurant (unsatisfactory resolution) and the manager said this is how dry tava chicken looks like. Do not order online as no one will listen to you even if you are right . Pathetic experience from SkyHilton and ZOMATO as well this time. Username: Sweety Singh , Comment: Username: Aman Bhardwaj , Comment: the food is awesome you can even visit here with your family the taste of food is ❤️❤️❤️ ****************************** Extracting Page# 2 ****************************** Username: Akanksha Singh , Comment: Username: Harsh Mehrotra , Comment: Username: Sheetal Kapoor , Comment: I have given them 4 stars because of the service as the restaurant need to really work upon that.
Username: Mâñvéñdrâ Singh , Comment: Username: Vishal Yadav , Comment: Good food ****************************** Extracting Page# 3 ****************************** Username: Avni Singh , Comment: Username: AVNI SINGH , Comment: Username: Avni Singh , Comment: Username: Vanshika Shukla , Comment: Username: Anushka Singh , Comment: ****************************** Extracting Page# 4 ****************************** Username: Anushka Singh , Comment: Username: Priya Singh , Comment: Username: Chandramohan Yadav , Comment: Staff and ambience is too good and a healthy and friendly environment Username: Kavita Vishwakarma , Comment: Username: Govind Bahadur , Comment: Good food good taste all time to choose this place for ordering and dining very good place and serve very good ****************************** Extracting Page# 5 ****************************** Username: Govind Bahadur , Comment: Such a recommended place to all.
Here food serve good with hygiene way and with a superior good taste. Username: Anuj Kashyap , Comment: My friend was suggested me to order from here and i verry surprised by there taste and food quality.
Thank you Sky Hilton to serve us verry well. Username: Anuj Kashyap , Comment: My friend was suggested me to order from here and i verry surprised by there taste and food quality.
Thank you Sky Hilton to serve us verry well. Username: Akash Choubey , Comment: Good food and very good taste my friend was suggested to order from here and I will totally appreciate the food taste and hygiene packing 😋😋 Username: Akshat Anand , Comment: fine dine restaurant is very excellent and the service person is very kind ; dheer singh who is so amazing and overall experience is very amazing ****************************** Extracting Page# 9 ****************************** Username: Anushree Nigam , Comment: Dheer was very courteous while serving! Username: Agosh Baranwal , Comment: Amazing staff. Very dedicated and polite. Username: Sameer Agarwal , Comment: Username: Vinod Kushwaha , Comment: Awesome food and service by Dheer singh Username: Manendra Singh , Comment: Nice ambiance music was soo good i love skyhilton exxillent service given by ajeet patel ****************************** Extracting Page# 10 ****************************** Username: Vandana Singh , Comment: awesome service very nice food 🎎🎎🎎🎎🎎🎎🎎🎎
Service dheer singh Username: Harpreet Singh , Comment: Best service by shubham kanchan Username: Shruti Mirchandani , Comment: Heard about this restaurant cum bar as one of the trending outlet in Lucknow in Alambagh.
Can visit for good food simply served in very simple way have tried Handi Mutton, Pasta, Paneer Tikka Masala, jeera rice and of course drinks.

Paneer tikka masala is actually good not like any other restaurant who put All that capsicum and onion in paneer tikka masala it's blend of flavor full masala and taste good.

Handi masala was also tasted good.

Though didn't like the ambience at all as it could be done better.

Also can eenjoy Hukka in open sitting area at fifth floor. Username: Anmol Kacker , Comment: I am writing this review after my fourth visit to this place. Rest all my visits were on a weekday afternoon so, decided to give this place a try on a Saturday night.
The ambiance though a lot changed than before, was good but that's pretty much it. The music was way too loud and deafening. They are currently having a street food festival so, decided to try a couple of items. Vada pav and omelette were the items ordered. Despite repeatedly telling the person who took the order to give a masala omelette, he got a plain one and that too cold. The crispy corn ordered was awful. Sweet corn soup, was simply cold water with some half boiled vegetables and traces of corn. It had just no taste at all. Tried finishing the items, unfortunately, couldn't even eat half of the meal.
Finally, decided to get up and walk away. Saturday nights can be maddening with overflowing crowd but atleast do something about your food. Quick service stands nowhere if what you are delivering is so bad. Really thought the place would be a bit different this time. Unfortunately, it was as bad as before. Done with this place ! Never again !

Also, I am not big a fan of saturday night parties but all I have to say here is that people were coming in, looking around and walking away. Seeing heavily drunken men dancing is not what a saturday night means to me or I guess to anyone. Username: Piyush Kumar , Comment: Please increase the salary of mr. Bhanu he is good in f&b Service skills