本文整理汇总了Python中portalpy.Portal.update_item方法的典型用法代码示例。如果您正苦于以下问题:Python Portal.update_item方法的具体用法?Python Portal.update_item怎么用?Python Portal.update_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portalpy.Portal
的用法示例。
在下文中一共展示了Portal.update_item方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_hostname_references
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import update_item [as 别名]
def update_hostname_references():
portal = Portal('http://portaldev.esri.com', 'admin', 'esri.agp')
hostname_map = {'wh94.fltplan.com:8080': 'wh94.fltplan.com'}
url_items = portal.search(['id','type','url'], portalpy.URL_ITEM_FILTER)
for item in url_items:
url = item.get('url')
if url:
url = normalize_url(url)
host = parse_hostname(url, include_port=True)
if host in hostname_map:
url = url.replace(host, hostname_map[host])
portal.update_item(item['id'], {'url': url})
webmaps = portal.webmaps()
for webmap in webmaps:
is_update = False
for url in webmap.urls():
normalized_url = normalize_url(url)
host = parse_hostname(normalized_url, include_port=True)
if host in hostname_map:
new_url = normalized_url.replace(host, hostname_map[host])
webmap.data = webmap.data.replace(url, new_url)
is_update = True
if is_update:
portal.update_webmap(webmap)
示例2: add_update_metadata
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import update_item [as 别名]
def add_update_metadata():
portal = Portal('http://portaldev.arcgis.com', 'admin', 'esri.agp')
portal.update_item('02ec2b569a38467dbb78a52ec7eb060e', \
metadata='C:\Projects\DOI\RFI\World.mxd.xml')
示例3: update_item_thumbnail
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import update_item [as 别名]
def update_item_thumbnail():
portal = Portal('http://wittm.esri.com', 'admin', 'esri.agp')
portal.update_item('726323baf8f44d6a8c55a77111db9b2c',
thumbnail='http://bit.ly/13RRmr0')
示例4: main
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import update_item [as 别名]
def main():
exit_err_code = 1
# Print/get script arguments
results = print_args()
if not results:
sys.exit(exit_err_code)
portal_address, adminuser, password = results
total_success = True
title_break_count = 100
section_break_count = 75
search_query = None
print '=' * title_break_count
print 'Prepare Items for Extract'
print '=' * title_break_count
try:
portal = Portal(portal_address, adminuser, password)
items = portal.search(q=search_query, sort_field='owner')
# ---------------------------------------------------------------------
# Prepare hosted service items
# ---------------------------------------------------------------------
# Add new tag to hosted service so we can identify the original
# hosted service after the portal items are published to a new portal
new_tags = ['Hosted Service']
print '\n{}'.format('-' * section_break_count)
print '- Prepare Hosted Service Items (Add tags: {})...'.format(', '.join(new_tags))
items_to_prep = get_hosted_service_items(portal, items)
for item_to_prep in items_to_prep:
print '\n {}'.format(format_hosted_item_info(item_to_prep))
tags = item_to_prep.get('tags')
for new_tag in new_tags:
if new_tag not in tags:
tags.append(new_tag)
# NOTE: have to pass new tags as string and not as a list
resp = portal.update_item(item_to_prep['id'], {'tags':', '.join(tags)})
if not resp:
print '***ERROR encountered during "update_item".'
total_success = False
except:
total_success = False
# Get the traceback object
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# Concatenate information together concerning the error
# into a message string
pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + \
"\nError Info:\n" + str(sys.exc_info()[1])
# Print Python error messages for use in Python / Python Window
print
print "***** ERROR ENCOUNTERED *****"
print pymsg + "\n"
finally:
print '\nDone.'
if total_success:
sys.exit(0)
else:
sys.exit(exit_err_code)