title: How to get all the pages with beautifulsoup?
body: <p>I want to get the link from all pages, already have this code but when I run the code it always shows error (return self.attrs[key]) KeyError : 'href'. Is anyone can help, thank you. Here is the code : </p>
  
  <pre><code>from bs4 import BeautifulSoup
  import urllib.request
  import requests
  
  
  
  url = "http://makeupuccino.com/makeup/faces/foundation?page={}"
  
  
  def get_url(url):
      req = urllib.request.Request(url)
      return urllib.request.urlopen(req)
  
  link = []
  nama = []
  merek = []
  harga = []
  gambar = []
  deskripsi = []
  
  page = 1
  while (requests.get(url.format(page)).status_code==200):
      res = requests.get(url.format(page))
      print(res.url)
      soup = BeautifulSoup(res.content,"html.parser")
      items = soup.findAll("div",{"class":"product-block-inner"})
      if len(items)&lt;=1:break #untuk stop ketika produk tidak ditemukan lagi di page selanjutnya
      for item in items:
  
          new_link = item.find("div",{"class":"image"})
          print(new_link["href"])
  
  
      page+=1
  </code></pre>