
    %i5                         d dl Z d dlZd dlZd dlZd dlmZ dZdZdZdZdZ	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zy)    N)datetimez&https://reporter.gc-track.com/api/app/   i4  (fc323b1d03569f3be9e598df178017808b8bc9fbzXG@O1MKysSTBqxTc                     d| i}t        j                  t        dz   |      }d|_        t	        j
                  |j                        S )Nfacilityzreports/get_monthly_report.phputf-8requestspostapiUrlencodingjsonloadstext
facilityIdbodyrs      2/var/www/reporter.gc-track.com/app/lib/apicalls.pygetMonthlyReportr      s<    
#Df==tDAAJ::aff    c                     t         t        t        | |d}t        j                  t
        dz   |      }d|_        t        j                  |j                        S )N)userapp	api_tokenfacility_id
month_yearzreports/get_month_report.phpr   
api_userapp_idr   r
   r   r   r   r   r   r   )r   r   r   r   s       r   find_reportr!      sC    6izgqrDf;;TBAAJ::affr   c                     | |d}t        j                  t        dz   |      }d|_        t	        j
                  |j                        S )N)r   monthzreports/month_report_single.phpr   r	   r   r#   r   r   s       r   getMonthlyReportSingler%      s<    "U3Df>>EAAJ::affr   c                     t         t        t        | d}t        j                  t
        dz   |      }d|_        t        j                  |j                        d   d   S )N)r   r   r   r   zfacilities/list_facility.phpr   facility_listr   r   r   s      r   getFacilityInfor(   !   sJ    6izZDf;;DAAAJ::affo.q11r   c                      t        j                  t        dz         } d| _        t	        j
                  | j                        S )Nz#facilities/list_prod_facilities.phpr   r	   r   s    r   getProdFacilitiesr+   '   s0    fBBCAAJ::affr   c                      t        j                  t        dz         } d| _        t	        j
                  | j                        S )Nz"facilities/list_rev_facilities.phpr   r	   r*   s    r   getRevFacilitiesr-   ,   s0    fAABAAJ::affr   c                     dt        |       i}t        j                  t        dz   |      }d|_        t        j                  |j                        }t        |d         S )N
qr_contentztools/qr.phpr   data)strr
   r   r   r   r   r   r   )messager   r   responses       r   generateQRCoder4   1   sN    #g,'Df^+D1AAJzz!&&!Hx  r   c                     | |d}t        j                  t        dz   |      }d|_        t	        j
                  |j                        }|S )N)	componentr#   z,activations/get_valuerecord_month_single.phpr   r	   )componentIdr#   r   r   r3   s        r   getPressureGraphDatar8   8   s@    $u5DfKKDQAAJzz!&&!HOr   c                    t        j                  |d      }|j                  d      }| t        t        t
        |d}t        j                  t        dz   |      }d|_	        t        j                  |j                        }|S )Nz%Y-%m)	redbox_idr   r   r   selected_datez"activations/jockey_activations.phpr   )r   strptimestrftimer   r    r   r
   r   r   r   r   r   r   )redboxId
selectDatedate_objformatted_dater   r   r3   s          r   getJockeyGraphDatarB   ?   si      W5H&&w/N!(IftuDfAA$GAAJzz!&&!HOr   c                     | t         t        t        d}t        j                  t
        dz   |      }d|_        t        j                  |j                        }|S )Nr   r   r   r   zcomponents/list_sensor.phpr   r   r   r   r   r3   s       r   getSensorListrF   I   sD     9UDf99$?AAJzz!&&!HOr   c                     | |t         t        t        d}t        j                  t
        dz   |      }d|_        t        j                  |j                        S )N)r   r#   r   r   r   z*activations/get_month_pump_activations.phpr   r   r$   s       r   getMonthActivationsrH   |   sC    "U8&]fgDfII4PAAJ::affr   c                     | t         t        t        d}t        j                  t
        dz   |      }d|_        t        j                  |j                        }|S )NrD   zcomponents/list_component.phpr   r   rE   s       r   listComponentrJ      sD     9UDf<<TBAAJzz!&&!HOr   c                     | t         t        t        ||d}t        j                  t
        dz   |      }d|_        t        j                  |j                        }|S )N)r   r   r   r   
start_dateend_datez!messages/list_detectormessage.phpr   r   r   	startDateendDater   r   r3   s         r   listDetectorMessageByDaterQ      sJ     9bkw~Df@@FAAJzz!&&!HOr   c                     | t         t        t        d}t        j                  t
        dz   |      }d|_        t        j                  |j                        }|S )NrD   z messages/list_redboxmessage.php r   r   rE   s       r   listRedboxMessagerS      sD     9UDf??EAAJzz!&&!HOr   c                     | t         t        t        ||dd}t        j                  t
        dz   |      }d|_        t        j                  |j                        }|S )Nr   )r   r   r   r   rL   rM   is_monthly_reportmessages/index.phpr   r   rN   s         r   listAlertHistoryByDaterW      sT     9bkw~  TU  VDf11$7AAJzz!&&!HOr   c                     | t         t        t        dd}t        j                  t
        dz   |      }d|_        t        j                  |j                        }|S )Nr   )r   r   r   r   rU   rV   r   r   rE   s       r   listAlertHistoryrY      sG     9ijkDf11$7AAJzz!&&!HOr   c                     t         t        t        | ||d}t        j                  t
        dz   |      }d|_        t        j                  |j                        }|S )N)r   r   r   r:   rL   rM   z%activations/get_pump_staterecords.phpr   r   )r:   rL   rM   r   r   r3   s         r   getNewPumpInfor[      sQ    6iYeo  |D  EDfDDTJAAJzz!&&!HOr   )sysr   r
   
dateparserr   r   r    r   r   api_passwordr   r!   r%   r(   r+   r-   r4   r8   rB   rF   rH   rJ   rQ   rS   rW   rY   r[    r   r   <module>r`      s    
    	1	
6	 2

!fr   