Extract basemap/web layer url from ArcGIS pro using ArcPy

Idea created by AChristodoulou@tensing.com on Nov 23, 2018
    • deleted-user-59NIbCq7H8Ve
    • jhead@lakeworth
    • bixb0012
    • rteeuwen@tensing.com
    • AChristodoulou@tensing.com

    Retrieve url of a basemap/web map layer used in Arc GIS pro with arcpy 

    I would like to have the possibility to retrieve automatically (by using python) the url of a basemap/web layer which is in ArcGIS pro . As you can see in the image below, from the 'source' of the basemap layer I can manually retrieve the url of the basemap (web map layer).Url of a basemap/web map layer that can be seen in its properties (ArcGIS Pro)

    - I tried to retrieve the properties of the web layer by using arcpy.Describe but there was no method to evoke in order to retrieve the url of the web layer. I could retrieve though the name of the basemap and its dataType (InternetTiledLayer):
    Web layer properties with arcpy.Describe

    - I looked in the documentation for arcpy.Describe but it seems there are no specific methods that can be applied on web layers (ArcInfo Workstation Item properties—ArcPy Functions | ArcGIS Desktop ).
    - I also tried to access the CONNECTIONPROPERTIES  of the basemap layer but it appers that the connection properties are not applicable for web layers (Layer—ArcPy | ArcGIS Desktop ).


    If I could automatically (using ArcPy) extract the url of the basemap from ArcGIS Pro, then I could use the url to specify the basemap I want to have when publishing a web map automatically (by using ArcPy).