def _populate_user_info_msg(msg: UserInfo) -> None: msg.installation_id = Installation.instance().installation_id msg.installation_id_v3 = Installation.instance().installation_id_v3 if Credentials.get_current().activation: msg.email = Credentials.get_current().activation.email else: msg.email = ""
def _enqueue_new_report_message(self): self._report.generate_new_id() msg = ForwardMsg() msg.new_report.report_id = self._report.report_id msg.new_report.name = self._report.name msg.new_report.script_path = self._report.script_path # git deploy params deploy_params = self.get_deploy_params() if deploy_params is not None: repo, branch, module = deploy_params msg.new_report.deploy_params.repository = repo msg.new_report.deploy_params.branch = branch msg.new_report.deploy_params.module = module # Immutable session data. We send this every time a new report is # started, to avoid having to track whether the client has already # received it. It does not change from run to run; it's up to the # to perform one-time initialization only once. imsg = msg.new_report.initialize imsg.config.sharing_enabled = config.get_option( "global.sharingMode") != "off" imsg.config.gather_usage_stats = config.get_option( "browser.gatherUsageStats") imsg.config.max_cached_message_age = config.get_option( "global.maxCachedMessageAge") imsg.config.mapbox_token = config.get_option("mapbox.token") imsg.config.allow_run_on_save = config.get_option( "server.allowRunOnSave") imsg.environment_info.streamlit_version = __version__ imsg.environment_info.python_version = ".".join( map(str, sys.version_info)) imsg.session_state.run_on_save = self._run_on_save imsg.session_state.report_is_running = ( self._state == ReportSessionState.REPORT_IS_RUNNING) imsg.user_info.installation_id = Installation.instance( ).installation_id imsg.user_info.installation_id_v1 = Installation.instance( ).installation_id_v1 imsg.user_info.installation_id_v2 = Installation.instance( ).installation_id_v2 imsg.user_info.installation_id_v3 = Installation.instance( ).installation_id_v3 if Credentials.get_current().activation: imsg.user_info.email = Credentials.get_current().activation.email else: imsg.user_info.email = "" imsg.command_line = self._report.command_line imsg.session_id = self.id self.enqueue(msg)
def _maybe_enqueue_initialize_message(self): if self._sent_initialize_message: return self._sent_initialize_message = True msg = ForwardMsg() imsg = msg.initialize imsg.config.sharing_enabled = config.get_option( "global.sharingMode") != "off" imsg.config.gather_usage_stats = config.get_option( "browser.gatherUsageStats") imsg.config.max_cached_message_age = config.get_option( "global.maxCachedMessageAge") imsg.config.mapbox_token = config.get_option("mapbox.token") imsg.config.allow_run_on_save = config.get_option( "server.allowRunOnSave") LOGGER.debug( "New browser connection: " "gather_usage_stats=%s, " "sharing_enabled=%s, " "max_cached_message_age=%s", imsg.config.gather_usage_stats, imsg.config.sharing_enabled, imsg.config.max_cached_message_age, ) imsg.environment_info.streamlit_version = __version__ imsg.environment_info.python_version = ".".join( map(str, sys.version_info)) imsg.session_state.run_on_save = self._run_on_save imsg.session_state.report_is_running = ( self._state == ReportSessionState.REPORT_IS_RUNNING) imsg.user_info.installation_id = Installation.instance( ).installation_id imsg.user_info.installation_id_v1 = Installation.instance( ).installation_id_v1 imsg.user_info.installation_id_v2 = Installation.instance( ).installation_id_v2 if Credentials.get_current().activation: imsg.user_info.email = Credentials.get_current().activation.email else: imsg.user_info.email = "" imsg.command_line = self._report.command_line imsg.session_id = self.id self.enqueue(msg)