Flask Component Proxy - QuinnBast/SaskTel-Communication-Portal GitHub Wiki

Proxy

Proxy.py

The Proxy class is simply a helper class that helps to send and format HTTP requests. This class has two methods, to_broadsoft(method, url, data, user) which will send a request to the API server based on the input parameters, and will extract the appropriate cookie to send along with the data to ensure that the API server can validate the request. Furthermore, this method will return the response that is generated from the request that is sent. The second method, to_client(request) will format a Flask response to send to the frontend of the application. This response can be based off of a request sent by the requests library, or it can be generated empty.