<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Webmap print/export map don't include tokens in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-print-export-map-don-t-include-tokens/m-p/1221917#M7900</link>
    <description>&lt;P&gt;I have a secured a secured service that you either try to print or export it fails to export the secured layers. Print and export map don't appear to include the token. If you manually add the token to each layer that works. I'm using a built in user via a simple login with username and password. Is this a bug?&lt;BR /&gt;&lt;BR /&gt;version&amp;nbsp;&lt;SPAN&gt;arcgis==&lt;/SPAN&gt;&lt;SPAN&gt;2.0.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;code sample (with workaround)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        gis = GIS(portal_url, username=portal_username, password=portal_password)
        wm_item = gis.content.get('ITEMID')
        wm = WebMap(wm_item)

        e = polygon.extent
        ext = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
               "xmin": 14219202.665619811,
               "ymin": -3017623.8659692756,
               "xmax": 14225164.753826046,
               "ymax": -3005929.0006416594}

        # DW another esri bug? Doesn't add the token on print or export
        for layer in wm.layers:
            layer.token = gis._con.token

        map_options = {
            "extent": ext
        }

         # compose combined JSON
        print_options = {
            "mapOptions": map_options,
            "operationalLayers": wm._webmapdict["operationalLayers"],
            "baseMap": wm._basemap,
            "exportOptions": {"dpi": 96},
            "layoutOptions": layoutOptions
        }

        printed_file_url = wm.print(file_format='JPG', layout_template="A4 Landscape",
                                     extent=ext, layout_options=layoutOptions)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2022 05:49:19 GMT</pubDate>
    <dc:creator>DavidWilton</dc:creator>
    <dc:date>2022-10-14T05:49:19Z</dc:date>
    <item>
      <title>Webmap print/export map don't include tokens</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-print-export-map-don-t-include-tokens/m-p/1221917#M7900</link>
      <description>&lt;P&gt;I have a secured a secured service that you either try to print or export it fails to export the secured layers. Print and export map don't appear to include the token. If you manually add the token to each layer that works. I'm using a built in user via a simple login with username and password. Is this a bug?&lt;BR /&gt;&lt;BR /&gt;version&amp;nbsp;&lt;SPAN&gt;arcgis==&lt;/SPAN&gt;&lt;SPAN&gt;2.0.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;code sample (with workaround)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        gis = GIS(portal_url, username=portal_username, password=portal_password)
        wm_item = gis.content.get('ITEMID')
        wm = WebMap(wm_item)

        e = polygon.extent
        ext = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100},
               "xmin": 14219202.665619811,
               "ymin": -3017623.8659692756,
               "xmax": 14225164.753826046,
               "ymax": -3005929.0006416594}

        # DW another esri bug? Doesn't add the token on print or export
        for layer in wm.layers:
            layer.token = gis._con.token

        map_options = {
            "extent": ext
        }

         # compose combined JSON
        print_options = {
            "mapOptions": map_options,
            "operationalLayers": wm._webmapdict["operationalLayers"],
            "baseMap": wm._basemap,
            "exportOptions": {"dpi": 96},
            "layoutOptions": layoutOptions
        }

        printed_file_url = wm.print(file_format='JPG', layout_template="A4 Landscape",
                                     extent=ext, layout_options=layoutOptions)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 05:49:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-print-export-map-don-t-include-tokens/m-p/1221917#M7900</guid>
      <dc:creator>DavidWilton</dc:creator>
      <dc:date>2022-10-14T05:49:19Z</dc:date>
    </item>
  </channel>
</rss>

