Commit 9e66d799 authored by Tanguy's avatar Tanguy

Collecte des etudiants depuis beequick dans la db

parent ed82fdee
No preview for this file type
from BeequickClient import BeequickClient
import sqlite3
con = sqlite3.connect("../CNE.db")
db = con.cursor()
insert_req = "INSERT INTO membres VALUES(:id, :email, :nom, :prenom, :portable, :poste_id)"
update_req = "UPDATE membres SET id = :id, email = :email, nom = :nom, prenom = :prenom, portable = :portable, poste_id = :poste_id)"
bq = BeequickClient.admin()
membres = bq.getAllMembres()
for membre in membres:
id = membre["id"]
new = db.execute("SELECT * FROM membres WHERE id = :id", {"id": id}).fetchone() == None
req = insert_req if new else update_req
db.execute(req, membre)
con.commit()
con.close()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment