本文整理汇总了Python中pyral.Rally.put方法的典型用法代码示例。如果您正苦于以下问题:Python Rally.put方法的具体用法?Python Rally.put怎么用?Python Rally.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyral.Rally
的用法示例。
在下文中一共展示了Rally.put方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_story
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import put [as 别名]
def make_story(story_name, story_detail, username):
r = Rally(server, apikey=apikey, project=project)
r.enableLogging('rally.log')
wksp = r.getWorkspace()
proj = r.getProject(project)
info = {"Workspace": wksp.ref,
"Project": proj.ref,
"Name": story_name + " (web intake form from " + username + ")",
"Story Type": "New Feature",
"Description": story_detail}
story = r.put('Story', info)
return dict_from_story(story)
示例2: make_task
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import put [as 别名]
def make_task(task_name, task_user, task_detail, task_hours):
r = Rally(server, apikey=apikey, project=project)
wksp = r.getWorkspace()
proj = r.getProject(project)
aa = r.get('UserStory', fetch='FormattedID', query='FormattedID = "' + todo_story + '"', instance=True)
info = {"Workspace": wksp.ref,
"Project": proj.ref,
"WorkProduct": aa.ref,
"Name": task_name + " (" + task_user + ")",
"State": "Completed",
"Estimate": hours,
"Actuals": hours,
"TaskIndex": 1,
"Description": task_detail + " autocreated."}
task = r.put('Task', info)
for b in task:
return b.details()
示例3: main
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import put [as 别名]
def main(args):
options = [opt for opt in args if opt.startswith('--')]
args = [arg for arg in args if arg not in options]
if len(args) != 1:
errout(USAGE)
sys.exit(1)
storyID = args[0]
server, user, password, apikey, workspace, project = rallyWorkset(options)
if apikey:
rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
else:
rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
rally.enableLogging("rally.history.crtask")
# For a task: Workspace, Project, WorkProduct, Name, State, TaskIndex are required;
# Workspace cannot be specified in the JSON, it defaults to
# the logged in account's Workspace setting
# Project and WorkProduct must be object refs to relevant Rally Entity instances.
# In this example the WorkProduct is a UserStory (HierarchicalRequirement).
target_project = rally.getProject()
target_story = rally.get('UserStory', query='FormattedID = %s' % storyID, instance=True)
info = {
"Project" : target_project.ref,
"WorkProduct" : target_story.ref,
"Name" : "BigTaters",
"State" : "Defined",
"TaskIndex" : 1,
"Description" : "Fly to Chile next week to investigate the home of potatoes. Find the absolute gigantoidist spuds and bring home the eyes to Idaho. Plant, water, wonder, harvest, wash, slice, plunge in and out of hot oil, drain and enjoy! Repeat as needed.",
"Estimate" : 62.0,
"Actuals" : 1.0,
"ToDo" : 61.0,
"Notes" : "I have really only done some daydreaming wrt this task. Sorry Jane, I knew you had big plans for Frankie's blowout BBQ next month, but the honeycomb harvest project is taking all my time."
}
print "Creating Task ..."
task = rally.put('Task', info)
print "Created Task: %s OID: %s" % (task.FormattedID, task.oid)
示例4: RallyClient
# 需要导入模块: from pyral import Rally [as 别名]
# 或者: from pyral.Rally import put [as 别名]
class RallyClient(object):
def __init__(self, rally_server, username, password, oauth_key):
print "Initializing RallyClient\n"
self.rally_server = rally_server
rally_url = self.rally_server['url']
credentials = CredentialsFallback(self.rally_server, username, password).getCredentials()
self.rest_api = None
self.configure_proxy()
self.rest_api = Rally(URI(rally_url), credentials['username'], credentials['password'],
apikey=oauth_key if oauth_key else self.rally_server['oAuthKey'], verify_ssl_cert=False)
@staticmethod
def create_client(rally_server, username, password, oauth_key):
print "Executing create_client() in RallyClient class in RallyClient.py\n"
return RallyClient(rally_server, username, password, oauth_key)
def configure_proxy(self):
if self.rally_server['proxyHost']:
os.environ["HTTP_PROXY"] = "http://%s:%s" % (self.rally_server['proxyHost'], self.rally_server['proxyPort'])
os.environ["HTTPS_PROXY"] = "https://%s:%s" % (self.rally_server['proxyHost'], self.rally_server['proxyPort'])
if self.rally_server['proxyUsername']:
os.environ["HTTP_PROXY"] = "http://%s:%[email protected]%s:%s" % (
self.rally_server['proxyUsername'], self.rally_server['proxyPassword'],
self.rally_server['proxyHost'],
self.rally_server['proxyPort'])
os.environ["HTTPS_PROXY"] = "https://%s:%[email protected]%s:%s" % (
self.rally_server['proxyUsername'], self.rally_server['proxyPassword'],
self.rally_server['proxyHost'],
self.rally_server['proxyPort'])
def lookup_item_by_formatted_id(self, workspace, project, type, formatted_id):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
response = self.rest_api.get(type, fetch="ObjectID", query="FormattedID = %s" % formatted_id)
if not response.errors:
print("Total results: %d\n" % response.resultCount)
result = response.next()
return result.ObjectID
else:
print("The following errors occurred: ")
for err in response.errors:
print("\t" + err)
return None
def create_sub_item(self, workspace, project, properties, user_story_formatted_id, user_story_type, property_type,
item_type):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
story_ref = self.lookup_item_by_formatted_id(workspace, project, user_story_type, user_story_formatted_id)
property_dict = dict(ast.literal_eval(properties))
property_dict[property_type] = story_ref
return self.create_item(workspace, project, property_dict, item_type)
def create_item(self, workspace, project, properties, item_type):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
item_create_response = self.rest_api.put(item_type, properties)
print "Executed successful on Rally"
return item_create_response.FormattedID
def update_item(self, workspace, project, properties, item_formatted_id, item_type):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
item_object_id = self.lookup_item_by_formatted_id(workspace, project, item_type, item_formatted_id)
property_dict = dict(ast.literal_eval(properties))
property_dict["ObjectID"] = item_object_id
update_response = self.rest_api.post(item_type, property_dict)
print "Executed successful on Rally"
return update_response.FormattedID
def query(self, workspace, project, item_type, query, fetch="True", rollupdata=False):
self.rest_api.setWorkspace(workspace)
self.rest_api.setProject(project)
response = self.rest_api.get(item_type, fetch=fetch, query=query, projectScopeDown=rollupdata)
if not response.errors:
print("Total results: %d\n" % response.resultCount)
return response
else:
print("The following errors occurred: ")
for err in response.errors:
print("\t" + err)
return None
def get_user_object_id(self, owner_username=None, owner_name=None):
response = self.rest_api.getUserInfo(username=owner_username, name=owner_name)
return response[0].ObjectID