Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def __init__(self,readLink):
- if readLink==0:
- self.linksToRead = 1000000000
- else:
- self.linksToRead = readLink
- self.linkCount = 0
- self.wordsList =[]
- self.parsedLinks=[]
- self.urlList =[]
- self.connection = pymysql.connect(host='localhost',
- user='root',
- password='s3cr3tp@ssw0rd',
- db='scrapper',
- charset='utf8',
- cursorclass=pymysql.cursors.DictCursor, autocommit=True)
- with self.connection.cursor() as cursor:
- sql2 = "SELECT * FROM `linksparsed`"
- try:
- cursor.execute(sql2)
- #self.connection.commit()
- except Exception as ex:
- print(ex)
- result = cursor.fetchall()
- cursor.rowcount #shows 3
- totalLength = len(result) # shows 0
- for row in result:
- self.parsedLinks.append(row)
- def fetchall(self):
- """Fetch all the rows"""
- self._check_executed()
- if self._rows is None:
- return ()
- if self.rownumber:
- result = self._rows[self.rownumber:] <<-------
- else:
- result = self._rows
- self.rownumber = len(self._rows)
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement