This is the completed solution for the Diplay a web scene ArcGIS DevLab. ArcGIS DevLabs are short introductory tutorials to guide you through the three phases of building geospatial apps: Data, Design, Develop.
from arcgis.gis import GIS
dev_gis = GIS("https://www.arcgis.com")
print("Connected to {}".format(dev_gis.properties.portalName))
Connected to ArcGIS Online
webscene_search = dev_gis.content.search(query="LA Trails *", item_type="Web Scene")
webscene_search
[<Item title:"LA Trails and Trailheads" type:Web Scene owner:esri_devlabs>, <Item title:"3d trails and trailheads LA" type:Web Scene owner:tim.lohnes_Hayward>]
webscene_item = webscene_search[0]
webscene_item
WebScene
object.¶from arcgis.mapping import WebScene
la_trails = WebScene(webscene_item)
la_trails
op_layers = la_trails['operationalLayers']
print("The web scene has {} layers".format(len(op_layers)))
The web scene has 2 layers
for lyr in op_layers:
print("{}\n\t{}".format(lyr['title'], lyr['url']))
Trailheads - Trailheads https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0 Trails - Trails 0 https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0