def api_is_run(url):
"""Determine if a URL looks like a valid run URL"""
# Note that this generates an extra array element because of the
# leading slash.
url_parts = urlparse.urlparse(url).path.split('/')
if len(url_parts) != 6 \
or (url_parts[:3] != ['', 'pscheduler', 'tasks' ]) \
or (url_parts[4] != 'runs'):
return False
try:
uuid.UUID(url_parts[3])
uuid.UUID(url_parts[5])
except ValueError:
return False
return True
评论列表
文章目录