flowcraft/generator/report.py
def _init_live_reports(self, report_id):
        """Sends a POST request to initialize the live reports

        Parameters
        ----------
        report_id : str
            Hash of the report JSON as retrieved from :func:`~_get_report_hash`
        """

        logger.debug("Sending initial POST request to {} to start report live"
                     " update".format(self.broadcast_address))

        try:
            with open(".metadata.json") as fh:
                metadata = [json.load(fh)]
        except:
            metadata = []

        start_json = {
            "data": {"results": metadata}
        }

        try:
            requests.post(
                self.broadcast_address,
                json={"run_id": report_id, "report_json": start_json,
                      "status": self.status_info}
            )
        except requests.exceptions.ConnectionError:
            logger.error(colored_print(
                "ERROR: Could not establish connection with server. The server"
                " may be down or there is a problem with your internet "
                "connection.", "red_bold"))
            sys.exit(1)
def _init_live_reports(self, report_id):
        logger.debug("Sending initial POST request to {} to start report live"
                     " update".format(self.broadcast_address))

        try:
            with open(".metadata.json") as fh:
                metadata = [json.load(fh)]
        except:
            metadata = []

        start_json = {
            "data": {"results": metadata}
        }

        try:
            requests.post(
                self.broadcast_address,
                json={"run_id": report_id, "report_json": start_json,
                      "status": self.status_info}
            )
        except requests.exceptions.ConnectionError:
            logger.error(colored_print(
                "ERROR: Could not establish connection with server. The server"
                " may be down or there is a problem with your internet "
                "connection.", "red_bold"))
            sys.exit(1)
def _init_live_reports ( self , report_id ) : logger . debug ( "Sending initial POST request to {} to start report live" " update" . format ( self . broadcast_address ) ) try : with open ( ".metadata.json" ) as fh : metadata = [ json . load ( fh ) ] except : metadata = [ ] start_json = { "data" : { "results" : metadata } } try : requests . post ( self . broadcast_address , json = { "run_id" : report_id , "report_json" : start_json , "status" : self . status_info } ) except requests . exceptions . ConnectionError : logger . error ( colored_print ( "ERROR: Could not establish connection with server. The server" " may be down or there is a problem with your internet " "connection." , "red_bold" ) ) sys . exit ( 1 )
Sends a POST request to initialize the live reports

        Parameters
        ----------
        report_id : str
            Hash of the report JSON as retrieved from :func:`~_get_report_hash`
Sends a POST request to initialize the live reports