@@ -0,0 +1,1197 @@
+from sqlalchemy import create_engine, Column, Integer, DateTime%0Afrom sqlalchemy.ext.declarative import declarative_base%0Afrom sqlalchemy.orm import sessionmaker%0Aimport sensors, time%0A%0Aengine = create_engine('postgresql://bp2013h1:hirsch@172.16.22.247:5432/protodb')%0A %0ABase = declarative_base()%0A%0Aclass Measure(Base):%0A     __tablename__ = 'fabian_temperatures'%0A%0A     id = Column(Integer, primary_key=True)%0A     time = Column(DateTime)%0A     cpu_temp = Column(Integer)%0A     gpu_temp = Column(Integer)%0A     %0A     def __init__(self, time, cpu, gpu):%0A        self.time = time%0A        self.cpu_temp = cpu%0A        self.gpu_temp = gpu%0A     %0ABase.metadata.create_all(engine)%0A%0ASession = sessionmaker(bind=engine)%0Asession = Session()%0A%0Adef getTemp():%0A  sensors.init()%0A  try:%0A        chips = sensors.iter_detected_chips()%0A        cpu = chips.next()%0A        gpu = chips.next()%0A        cpu_iter = iter(cpu)%0A        gpu_iter = iter(gpu)%0A        cpu_temp = cpu_iter.next().get_value()%0A        gpu_temp = gpu_iter.next().get_value()%0A  finally:%0A        sensors.cleanup()%0A  return cpu_temp, gpu_temp%0A%0Awhile True:%0A  cpu,gpu = getTemp()%0A  session.add( Measure(time.asctime(), cpu, gpu) )%0A  session.commit()%0A  time.sleep(5)%0A

add crawler with sqlAlchemy