Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_link():
- cursor = connection.cursor()
- cursor.execute("SELECT * FROM `websites_queue`")
- records = cursor.fetchone()
- cursor.close
- if records is None:
- sys.exit(0)
- cursor = connection.cursor()
- cursor.execute("SELECT `link` FROM `websites_queue` ORDER BY RAND() LIMIT 1")
- records = cursor.fetchall()
- global new_link
- for record in records:
- new_link = record[0]
- cursor.close
- cursor = connection.cursor()
- cursor.execute("DELETE FROM `websites_queue` WHERE `link` = :link", (new_link))
- connection.commit()
- cursor.close
- return new_link
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement