input: Write a function to scrape all the links from a given website using Python. The function should return a list of URLs found on the website. If the website is unreachable or the request fails, the function should return an empty list.
  
  def scrape_links(url):
      try:
          import requests as req 
          from bs4 import BeautifulSoup 
          
          r = req.get(url) 
          if r.status_code != 200:
              return []
          
          soup = BeautifulSoup(r.text, "html.parser") 
          links = soup.find_all('a') 
          urls = [link.get('href') for link in links if link.get('href')]
          return urls
      except:
          return []
  
  assert scrape_links("http://www.example.com")==['/', 'http://www.iana.org/domains/example']
  assert scrape_links("http://www.nonexistentwebsite.com")==[]
  assert scrape_links("http://www.htmlonlysite.com")==['/', '/page1', '/page2']
  assert scrape_links("http://www.missinglinks.com")==[]
  assert scrape_links("http://www.serverdown.com")==[]
output: def scrape_links(url):
      try:
          import requests as req 
          from bs4 import BeautifulSoup 
          
          r = req.get(url) 
          if r.status_code != 200:
              return []
          
          soup = BeautifulSoup(r.text, "html.parser") 
          links = soup.find_all('a') 
          urls = [link.get('href') for link in links if link.get('href')]
          return urls
      except:
          return []