input: Write a python function to scrape product details from an Amazon page.
  assert scrape_amazon('https://www.amazon.com/')==[{'Category': 'Electronics', 'Title': 'Some Product', 'Price': '299', 'Rating': '4.5 out of 5 stars'}, ...]
  assert scrape_amazon('https://www.amazon.com/some-other-page')==[{'Category': 'Books', 'Title': 'Some Book', 'Price': '19.99', 'Rating': '4.7 out of 5 stars'}, ...]
  assert scrape_amazon('https://www.amazon.com/yet-another-page')==[{'Category': 'Home & Kitchen', 'Title': 'Some Appliance', 'Price': '99.99', 'Rating': '4.3 out of 5 stars'}, ...]
output: import requests
  from bs4 import BeautifulSoup
  
  def scrape_amazon(url):
      headers = {
          'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
      }
      response = requests.get(url, headers=headers)
      soup = BeautifulSoup(response.content, 'html.parser')
      
      products = []
      
      for product in soup.select('.s-main-slot .s-result-item'):
          try:
              title = product.h2.text.strip()
          except AttributeError:
              title = None
              
          try:
              price = product.select_one('.a-price .a-offscreen').text.strip().replace('$', '')
          except AttributeError:
              price = None
          
          try:
              rating = product.select_one('.a-icon-alt').text.strip()
          except AttributeError:
              rating = None
          
          try:
              category = soup.select_one('#nav-subnav .nav-a-content').text.strip()
          except AttributeError:
              category = None
          
          if title and price and rating and category:
              products.append({
                  'Category': category,
                  'Title': title,
                  'Price': price,
                  'Rating': rating
              })
      
      return products