I am trying to query a URL address from mysql database so that I can connect using this address and scrape a website. however I get an error
Code:
cnx = mysql.connector.connect(host=mysql_host, user=mysql_localhost_user, password=mysql_localhost_password, database=mysql_localhost_database)
cursor = cnx.cursor()
cursor.execute("SELECT url FROM masjid where ID =" + str(start) )
results2 = cursor.fetchone()
masjid_url = results2[0]
cursor.close()
cnx.close()
content1 = urllib2.urlopen(masjid_url).read()
Error:
masjid_url = results2[0]
TypeError: 'NoneType' object is not subscriptable