title: How to get ratings from a bookstoscrape website and feed it into database
body: <p>Currently, I'm trying to get ratings from a website called <a href="https://books.toscrape.com/" rel="nofollow noreferrer">bookstoscrape</a> and feed it into a database as a practice, but there's an error raised:</p>
  <blockquote>
  <p>InterfaceError: Error binding parameter 1 - probably unsupported type.</p>
  </blockquote>
  <p>Here's my code:</p>
  <pre><code>from bs4 import BeautifulSoup
  import requests
  import sqlite3
  import re
  
  conn = sqlite3.connect('scraped.db')
  curs = conn.cursor()
  
  curs.execute(''' CREATE TABLE CATEGORY(Id INTEGER PRIMARY KEY,NAME TEXT)''')
  curs.execute(''' CREATE TABLE BOOKS(Category_Id INTEGER, NAME TEXT,PRICE INTEGER,RATING TEXT)''')
  
  html_content = requests.get('http://books.toscrape.com')
  soup = BeautifulSoup(html_content.content)
  
  url = &quot;http://books.toscrape.com/&quot;
  
  def getURLs(url):
      result = requests.get(url)
      soup = BeautifulSoup(result.text, 'html.parser')
      return(soup)
  def getBooks(url):
      soup = getURLs(url)
      # remove the index.html part of the base url before returning the results
      return([&quot;/&quot;.join(url.split(&quot;/&quot;)[:-1]) + &quot;/&quot; + x.find(&quot;div&quot;).find(&quot;a&quot;).get('href') for x in soup.findAll(&quot;article&quot;, attrs = {&quot;class&quot;:&quot;product_pod&quot;})])
  
  pages_urls = []
  new_page = &quot;http://books.toscrape.com/catalogue/page-1.html&quot;
  
  while requests.get(new_page).status_code == 200:
      pages_urls.append(new_page)
      new_page = pages_urls[-1].split(&quot;-&quot;)[0] + &quot;-&quot; + str(int(pages_urls[-1].split(&quot;-&quot;)[1].split(&quot;.&quot;)[0]) + 1) + &quot;.html&quot;
  
  booksURLs = []
  for page in pages_urls:
      booksURLs.extend(getBooks(page))
  
  names = []
  prices = []
  rate = []
  for x in range(len(booksURLs)):
      soup = getURLs(url)
      all_articles = soup.find_all(&quot;article&quot;, attrs = {&quot;class&quot;:&quot;product_pod&quot;})
  
      for article in all_articles:
          
          names.append(soup.find(&quot;article&quot;, class_ = (&quot;product_pod&quot;)).find(&quot;h3&quot;).get_text())
          prices.append(soup.find(&quot;p&quot;, class_ = &quot;price_color&quot;).text[2:]) # get rid of the pound sign
          rate.append(soup.find(&quot;article&quot;, class_ = (&quot;product_pod&quot;)).find('p').get('class')[1])
  
          curs.execute(&quot;INSERT INTO BOOKS VALUES(?,?,?,?)&quot;,(x,names,prices,rate))
  
  conn.commit()
  conn.close()
  </code></pre>