Пример #1
0
def _print_url():
    title_message = "You can now view your Streamlit app in your browser."
    named_urls = []

    if config.is_manually_set("browser.serverAddress"):
        named_urls = [
            ("URL", Report.get_url(config.get_option("browser.serverAddress")))
        ]

    elif config.get_option("server.headless"):
        named_urls = [
            ("Network URL", Report.get_url(util.get_internal_ip())),
            ("External URL", Report.get_url(util.get_external_ip())),
        ]

    else:
        named_urls = [
            ("Local URL", Report.get_url("localhost")),
            ("Network URL", Report.get_url(util.get_internal_ip())),
        ]

    click.secho("")
    click.secho("  %s" % title_message, fg="blue", bold=True)
    click.secho("")

    for url_name, url in named_urls:
        util.print_url(url_name, url)

    click.secho("")
Пример #2
0
def _print_url():
    title_message = 'You can now view your Streamlit report in your browser.'
    named_urls = []

    if config.is_manually_set('browser.serverAddress'):
        named_urls = [
            ('URL',
             Report.get_url(config.get_option('browser.serverAddress'))),
        ]

    elif config.get_option('server.headless'):
        named_urls = [
            ('Network URL', Report.get_url(util.get_internal_ip())),
            ('External URL', Report.get_url(util.get_external_ip())),
        ]

    else:
        named_urls = [
            ('Local URL', Report.get_url('localhost')),
            ('Network URL', Report.get_url(util.get_internal_ip())),
        ]

    click.secho('')
    click.secho('  %s' % title_message, fg='green')
    click.secho('')

    for url_name, url in named_urls:
        util.print_url(url_name, url)

    click.secho('')
Пример #3
0
    def serialize_running_report_to_files(self):
        """Return a running report as an easily-serializable list of tuples.

        Returns
        -------
        list of tuples
            See `CloudStorage.save_report_files()` for schema. But as to the
            output of this method, it's just a manifest pointing to the Server
            so browsers who go to the shareable report URL can connect to it
            live.

        """
        LOGGER.debug("Serializing running report")

        manifest = self._build_manifest(
            status=StaticManifest.RUNNING,
            external_server_ip=util.get_external_ip(),
            internal_server_ip=util.get_internal_ip(),
        )

        return [("reports/%s/manifest.pb" % self.report_id,
                 manifest.SerializeToString())]
Пример #4
0
    def serialize_running_report_to_files(self):
        """Return a running report as an easily-serializable list of tuples.

        Returns
        -------
        list of tuples
            See `CloudStorage.save_report_files()` for schema. But as to the
            output of this method, it's just a manifest pointing to the Server
            so browsers who go to the shareable report URL can connect to it
            live.

        """
        LOGGER.debug('Serializing running report')

        manifest = self._build_manifest(
            status='running',
            external_server_ip=util.get_external_ip(),
            internal_server_ip=util.get_internal_ip(),
        )

        manifest_json = json.dumps(manifest).encode('utf-8')

        return [('reports/%s/manifest.json' % self.report_id, manifest_json)]