def location_all(location,inside_location): import requests from bs4 import BeautifulSoup from Main_function_For_location import main location =location.replace(" ", "").lower() inside_location = inside_location.replace(" ", "-").lower() url = f"https://www.eateasy.ae/{location}/{inside_location}-restaurants" payload = {} files = {} headers = { 'Cookie': 'eateasy-ae-website=lai3mvcb9hd99nnivbt0pn68ibfjsd6g', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' } response = requests.post(url, headers=headers, data=payload, files=files) hrefs = [] i = 1 if response.status_code == 200: soup = BeautifulSoup(response.text, 'html.parser') links = soup.find_all('a', class_='eateasy-restaurant-box-inner') for link in links: href = link.get('href') if href: hrefs.append(href) print(f"Found {len(href)} Links") if hrefs: for href in hrefs: print(href) main(href,location,inside_location) i = i+1 if i == 21: break print(" DONE ") else: print(f"Failed to retrieve the page. Status code: {response.status_code}")