Skip to content

Instantly share code, notes, and snippets.

@Phyks
Created June 20, 2014 23:06
Show Gist options
  • Save Phyks/23ccf7ca33d96c29d6fd to your computer and use it in GitHub Desktop.
Save Phyks/23ccf7ca33d96c29d6fd to your computer and use it in GitHub Desktop.
def notifs_emprunts(self, serv):
"""Notifications when borrowing is over"""
now = datetime.datetime.now()
1h_later = now + datetime.timedelta(hours=1)
query = ("SELECT borrower, tool, until FROM borrowings " +
"WHERE until BETWEEN %s AND %s")
try:
self.bdd_cursor.execute(query, (now, 1h_later))
except mysql.connector.errors.Error:
serv.say(serv,
"Impossible de récupérer les notifications d'emprunts.")
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment