input: Write a function to scrape photos and captions from a given website URL and return a list of dictionaries containing the photo source and its corresponding caption. If the photo has no caption, include a caption string that says "No caption". If the URL is invalid or the website cannot be reached, return an empty list.
  
  from bs4 import BeautifulSoup
  import requests
  
  def scrape_photos_with_captions(url):
      try:
          req = requests.get(url)
          req.raise_for_status()
          html = req.text
      except requests.RequestException:
          return []
      
      soup = BeautifulSoup(html, features='lxml')
      image_dicts = []
      image_divs = soup.find_all('div', {'class': 'image-gallery__image'})
      
      for image_div in image_divs:
          figure = image_div.find('figure')
          src = figure.find('img')['src']
          caption = figure.find('figcaption')
          caption_text = caption.text if caption else 'No caption'
          image_dicts.append({'src': src, 'caption': caption_text})
      
      return image_dicts
  
  assert scrape_photos_with_captions('https://example.com/webpage') == [{'src': 'image1.jpg', 'caption': 'Example Caption'}, {'src': 'image2.jpg', 'caption': 'No caption'}]
  assert scrape_photos_with_captions('https://nonexistentwebsite.com/page') == []
output: 
  def scrape_photos_with_captions(url):
      try:
          req = requests.get(url)
          req.raise_for_status()
          html = req.text
      except requests.RequestException:
          return []
      
      soup = BeautifulSoup(html, features='lxml')
      image_dicts = []
      image_divs = soup.find_all('div', {'class': 'image-gallery__image'})
      
      for image_div in image_divs:
          figure = image_div.find('figure')
          src = figure.find('img')['src']
          caption = figure.find('figcaption')
          caption_text = caption.text if caption else 'No caption'
          image_dicts.append({'src': src, 'caption': caption_text})
      
      return image_dicts
  