Option 1: Edit SDdraft file directly
You will need to create the SDdraft files and then modify them using the minidom library before you publish. There is an example of this in the 10.3 help. See 'Modify SDDraft example 1': http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/createmapsddraft.htm
From ESRI's example, a service's description is changed to 'US Counties Map':
import arcpy
import xml.dom.minidom as DOM
# the new description
newDesc = 'US Counties Map'
xml = r"C:\Project\Counties.sddraft"
doc = DOM.parse(xml)
# find the Item Information Description element
descriptions = doc.getElementsByTagName('Description')
for desc in descriptions:
if desc.parentNode.tagName == 'ItemInfo':
# modify the Description
if desc.hasChildNodes():
desc.firstChild.data = newDesc
else:
txt = doc.createTextNode(newDesc)
desc.appendChild(txt)
# output to a new sddraft
outXml = r"C:\Project\Output\CountiesForWeb.sddraft"
f = open(outXml, 'w')
doc.writexml( f )
f.close()
Option 2: Use Python API and JSON
ESRI's python API was recently updated to support service modification. You can use the edit function to modify the service by submitting a JSON representation of the service. You can use Python's JSON library to add a description.
JSON Example. See Description tag:
{
"currentVersion": <currentVersion>, //Added at 10.0 SP1
"serviceDescription" : "<serviceDescription>",
"mapName" : "<mapName>"
"description": "<description>",
"copyrightText" : "<copyrightText>",
"supportsDynamicLayers" : <true|false>, //Added at 10.1
"layers": [ //the spatial layers published by this service
...