input: Write a function to create a web scraper in Python that can extract hotel reviews from TripAdvisor. The function should take a URL as input, send a request to the URL with specified headers, parse the HTML response, find all review containers, and print the title and text of each review. If the URL is empty or invalid, the function should return an error message.
  import requests
  from bs4 import BeautifulSoup
  
  def scrape_hotel_reviews(url):
      if not url:
          return "Error: URL cannot be empty."
      
      headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'}
  
      try:
          response = requests.get(url, headers=headers)
          response.raise_for_status()  # Raise an exception for HTTP errors
      except requests.exceptions.RequestException as e:
          return f"Error: {e}"
  
      soup = BeautifulSoup(response.text, 'html.parser')
      reviews = soup.find_all('div', {'class': 'review-container'})
  
      if not reviews:
          return "No reviews found."
  
      output = []
      for review in reviews:
          title = review.find('span', {'class': 'noQuotes'}).text
          text = review.find('p', {'class': 'partial_entry'}).text
          output.append(f"{title}\n{text}\n{'-' * 50}")
      
      return "\n".join(output)
  
  # Example test cases
  assert scrape_hotel_reviews('') == "Error: URL cannot be empty."
  assert "No reviews found." in scrape_hotel_reviews('https://www.example.com/invalid-page')
  assert scrape_hotel_reviews('https://www.tripadvisor.com/valid-hotel-page')  # Output will depend on the actual content of the page
output: def scrape_hotel_reviews(url):
      if not url:
          return "Error: URL cannot be empty."
      
      headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'}
  
      try:
          response = requests.get(url, headers=headers)
          response.raise_for_status()  # Raise an exception for HTTP errors
      except requests.exceptions.RequestException as e:
          return f"Error: {e}"
  
      soup = BeautifulSoup(response.text, 'html.parser')
      reviews = soup.find_all('div', {'class': 'review-container'})
  
      if not reviews:
          return "No reviews found."
  
      output = []
      for review in reviews:
          title = review.find('span', {'class': 'noQuotes'}).text
          text = review.find('p', {'class': 'partial_entry'}).text
          output.append(f"{title}\n{text}\n{'-' * 50}")
      
      return "\n".join(output)