a
    h_a                     @   s   d dl mZmZmZmZmZmZ d dlZd dlZd dl	m
Z
 d dlZd dlmZ eeZdZejdddgd	d
d Zejdddgd	dd Zeddd Zedkrejdddd dS )    )Flaskrender_templateurl_forrequestredirectsessionN)escape)datetimezstop_history.json/POSTZGET)methodsc                  C   s   t jdkrt jd} zt| atd zttdd}t	
|}W d    n1 sV0    Y  |t ttdd*}|d t	j||dd	 W d    n1 s0    Y  td
tt W W S    td Y W S 0 W n   td Y S 0 tdS )Nr   secondsztest int durationr)modewr      )indentz/good/zerror_save.html/errorz
index.html)r   methodZformgetintZduration_intprintopenPATH_HISTORYjsonloadappendseekdumpr   strr   )durationfiledata r#   H/home/pi/Desktop/dev.gyre.ch/Source/adrien.capt/projet/h/servercamsys.pyindex   s$    
(

.r%   z/good/<duration>c                 C   s   d| i}t di |S )Ntime	good.html)r'   r   )r    ZtemplateDatar#   r#   r$   good%   s    r)   r   c                   C   s   t dS )Nz
error.htmlr(   r#   r#   r#   r$   error+   s    r*   __main__z0.0.0.0P   T)hostportdebug)Zflaskr   r   r   r   r   r   Zrequestsr   Z
markupsafer   r&   r	   __name__Zappr   router%   r)   r*   runr#   r#   r#   r$   <module>   s    


