{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Publish a visualization from a public table\n", "\n", "This example illustrates how to publish a visualization using a public table. You do not need a Maps API key to visualize a public table within a notebook. However you do need an API Key to publish any visualization, whether its data is public or private.\n", "\n", "Read more about API Keys here: https://carto.com/developers/auth-api/guides/types-of-API-Keys/\n", "\n", ">_Note: You'll need your [CARTO Account](https://carto.com/signup) credentials to reproduce this example._" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from cartoframes.auth import set_default_credentials\n", "\n", "set_default_credentials('creds.json')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from cartoframes.viz import Map, Layer\n", "\n", "map_viz = Map(Layer('public_table'))" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'id': '61ccd727-9716-4d5d-84a1-490cdd4f4aec',\n", " 'url': 'https://cartoframes-org.carto.com/u/cartoframes/kuviz/61ccd727-9716-4d5d-84a1-490cdd4f4aec',\n", " 'name': 'map_public_table',\n", " 'privacy': 'public'}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "map_viz.publish(\n", " name='map_public_table',\n", " password=None,\n", " if_exists='replace')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.7" } }, "nbformat": 4, "nbformat_minor": 2 }