3
؀h                 @   s   d dl mZmZmZmZ d dlmZmZ d dlZd dlZd dl	Z	d dl
Z
d dlZd dlmZmZ d dlmZ d dlmZmZ d dlmZ dd	 Zejd
ejddd Zejddd Zejddd Zejddd Zejddd ZdS )    )jsonifyrequestjsonmake_response)datetime	timedeltaN)appbookings_logger)Booking)dbmemoise_cache)get_booking_status_idc            	   C   s    t j  tj  W d Q R X d S )N)r   app_contextr   clear r   r   (/booking_service/app/routes/base_urls.pyclearMemoCache   s    
r   /z/indexc              C   s   g } | j d t| S )NzIHello world. Welcome to the booking service. We hope you enjoy your stay.)appendr   )outputr   r   r   index$   s    
r   z/requestc              C   sn   t tj} ytjj}W n tk
r.   d }Y nX ytjjj }W n tk
rX   d }Y nX t| ||ddfS )N)headersplatformbrowser   )	dictr   r   
user_agentr   	Exceptionr   titler   )header_dictr   r   r   r   r   get_request_info,   s    


r    z/test-beforec               C   s   dS )NOkr   r   r   r   r   test_before_requestK   s    r"   z/memo-cache/clearc               C   s   t   tddidfS )NmessagezMemo cache cleared.r   )r   r   r   r   r   r   clear_memo_cacheP   s    r$   i  c             C   s4   g }|j t|  tjd}t|j}d|jd< |S )Nzhttps://http.cat/404z
image/jpegzContent-Type)r   strrequestsgetr   contentr   )er   datarespr   r   r   page_not_foundd   s    


r,   )flaskr   r   r   r   r   r   pymysqlosmathr&   uuidroutesr   r	   database.bookingsr
   r   r   routes.bookings_urlsr   r   router   r    r"   r$   errorhandlerr,   r   r   r   r   <module>   s   (