def postcmd(self, stop, line): def send_to_faraday(ws, data): spinner = Halo(text="Sending", text_color="green", spinner="dots") spinner.start() try: self.api_client.bulk_create(ws, data) except Exception as e: spinner.stop() return str(e) else: spinner.stop() return None while not self.data_queue.empty(): data = self.data_queue.get() message = f"{self.emojis['arrow_up']} Sending data to workspace: {data['workspace']}" # noqa: E501 self.poutput(style(message, fg=COLORS.GREEN)) upload_error = send_to_faraday(data["workspace"], data["json_data"]) if upload_error is not None: self.poutput( style( f"\n{self.emojis['cross']} {upload_error}", fg=COLORS.RED, )) else: self.poutput( style(f"\n{self.emojis['check']} Done", fg=COLORS.GREEN)) return Cmd.postcmd(self, stop, line)
def postcmd(self, stop, line): @Halo(text="Sending", text_color="green", spinner="dots") def send_to_faraday(ws, data): self.api_client.bulk_create(ws, data) while not self.data_queue.empty(): data = self.data_queue.get() message = f"{self.emojis['arrow_up']} Sending data to workspace: {data['workspace']}" self.poutput(style(message, fg="green")) send_to_faraday(data["workspace"], data["json_data"]) self.poutput(style(f"{self.emojis['check']} Done", fg="green")) return Cmd.postcmd(self, stop, line)
def postcmd(self, stop, line): self.set_prompt() return Cmd.postcmd(self, stop, line)
def postcmd(self, stop, line): ''' Exit cmd cleanly. ''' self.color_prompt() return Cmd.postcmd(self, stop, line)
def postcmd(self, *args): if not self.quiet: self.prompt = self.color_prompt() return Cmd.postcmd(self, *args)
def postcmd(self, *args): ''' call the hook _post and delegate to plugins ''' self._post(*args) return Cmd.postcmd(self, *args)