Internals

client.py

class pyrally.client.RallyAPIClient(username, password, base_url)[source]
get_all_entities()[source]

Get all stories, defects and tasks.

Returns:A list of BaseRallyModel inherited objects.
get_all_in_kanban_states(kanban_states)[source]

Get all stories and defects in the given kanban_state.

Parameters:kanban_state – A list of kanban states to search on.
Returns:A dictionary containing keys for stories and defects, and values of lists of associated Story and Defect objects.
get_story_by_formatted_id(story_id)[source]

Return the story with the id story_id.

Parameters:story_id – The USXXX story id of the story.
Returns:A Story object.
get_defect_by_formatted_id(defect_id)[source]

Return the defect with the id defect_id.

Parameters:defect_id – The DEXXX defect id of the defect.
Returns:A Defect object.
get_entity_by_formatted_id(entity_id)[source]

Return the entity with the id entity_id.

Parameters:entity_id – The YYXXX id of the story/defect/task.
Returns:A BaseRallyModel inheritted object, or None if no artifacts could be found.

rally_access.py

exception pyrally.rally_access.UnexpectedResponse[source]
pyrally.rally_access.MEM_CACHE = defaultdict(<type 'dict'>, {})

Dictionary of request_type: {request: (response, time_of_stored_request)}

pyrally.rally_access.CACHE_TIMEOUT = 120

Seconds to store an item in memory for, before it needs refreshing

pyrally.rally_access.get_accessor(username=None, password=None, rally_base_url=None)[source]
class pyrally.rally_access.RallyAccessor(username, password, base_url)[source]
make_url_safe(url)[source]

Make the given url safe for use against the Rally API.

Parameters:url – The url we want to make safe.
Returns:A new url string with all ” ”, “(”, ”)” and ‘”’ characters replaced by html % characters.
set_cache_timeout(cache_key, timeout)[source]

Set the timeout for the given cache_key.

Parameters:
  • cache_key – The cache key to set a timeout for.
  • timeout – The time in seconds to keep items in cache_key for.
delete_from_cache(cache_key, cache_index)[source]

Delete the item from the cache.

Parameters:
  • cache_key – The key to look up in order to find the cache_index.
  • cache_index – The index of within cache_key to delete.

This does not raise a KeyError if the object can’t be found.

get_cacheable_info(url)[source]

Return interesting bits of the url for caching.

Parameters:url – The url being cached.
Returns:A tuple of cache_key (ie the API object type) and cache_lookup (the id of the object, or the query string if not a specific object.)
get_from_cache(url)[source]

Attempt to get the url result from the cache.

Returns:The contents stored against the cache_key, cache_lookup in the cache, derived from the url (if it has not expired). Otherwise returns False.
set_to_cache(url, data)[source]

Set the url in the cache to have this data.

Parameters:
  • url – The url to index the data against. This url will be broken down into cache_key, cache_lookup items and indexed.
  • data – The data to store against the broken down url.
make_api_call(url, full_url=False, method='GET', data=None)[source]

Make a call against the API at the given url.

Parameters:
  • url – The url to make the call against. Note that this will be converted before being used through make_url_safe().
  • full_url – Boolean. If True, it is assumed that the url contains the stem of the API call as opposed to a relative one in the case of False.
  • method – String describing HTTP method to use. One of GET, POST or DELETE.
  • data – Dictionary. Used as part of a PUT or POST request.
Returns:

The JSON data as returned by the API converted into python dictionary objects. This is done either by looking in the cache, or by actually getting it from the server.

models.py

For the latest API information go to https://rally1.rallydev.com/slm/doc/webservice/

exception pyrally.models.ReferenceNotFoundException[source]

Bases: exceptions.Exception

args
message
pyrally.models.get_query_clauses(clauses, joiner=' and ')[source]

Return clauses used for querying objects from the API.

Parameters:clauses – A list of clause strings to be joined in the correct fashion using joiner and brackets
Param:joiner: This should either be `` and `` or `` or . All clauses in ``clause are joined together using this operator.
Returns:A single query_clause string containing all of clauses.
class pyrally.models.RegisterModels(name, bases, attrs)[source]

Bases: type

A metaclass used for registering all BaseRallyModel subclasses

mro() → list

return a type’s method resolution order

class pyrally.models.BaseRallyModel(data_dict={})[source]

Bases: object

sub_objects_dynamic_loader = {}

A dictionary of property_name: key_name.

Where property_name is the name of a property on the class which refers to a dynamically loaded list of items found in the rally_data key key_name.

classmethod set_cache_timeout(timeout)[source]

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
classmethod create_from_ref(reference)[source]

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
classmethod get_all(clauses=None)[source]

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
classmethod get_all_results_for_query(query_string)[source]

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
classmethod _get_results_page(query_string, start_index=1)[source]

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

classmethod convert_from_query_result(results, full_objects=False)[source]

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

classmethod get_by_formatted_id(formatted_id)[source]

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
update(**kwargs)[source]

Update all the attributes in rally_data specified in kwargs.

title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
ref
update_rally(refresh=True)[source]

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
delete()[source]

Delete this object from Rally

delete_from_cache()[source]

Remove this item from the cache

class pyrally.models.Artifact(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'Artifact'
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.Task(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'Task'
classmethod get_all_for_story(story_id)[source]

Get all the tasks for the given story_id.

Parameters:story_id – The USXXX or DEXXX parent ID of a task to search for.
Returns:A list of Task objects, as returned by get_all
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.HierarchicalRequirement(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'HierarchicalRequirement'
sub_objects_dynamic_loader = {'tasks': 'Tasks', 'children': 'Children'}
classmethod get_all_in_kanban_states(kanban_states)[source]

Get all the stories in the given kanban_state.

Parameters:kanban_state – A list of kanban states to search on.
Returns:A list of Story objects, as returned by get_all
classmethod get_all_in_iteration(iteration_name)[source]
rally_url
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.Defect(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'Defect'
sub_objects_dynamic_loader = {'tasks': 'Tasks'}
classmethod get_all_in_kanban_states(kanban_states)[source]

Get all the defects in the given kanban_state.

Parameters:kanban_state – A list of kanban states to search on.
Returns:A list of Defect objects, as returned by get_all
rally_url
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.User(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'User'
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.Iteration(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'Iteration'
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.Project(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'Project'
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.Workspace(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'Workspace'
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.Release(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'Release'
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
class pyrally.models.TestCase(data_dict={})[source]

Bases: pyrally.models.BaseRallyModel

rally_name = 'TestCase'
_get_results_page(query_string, start_index=1)

Get a page of results for the query given.

Parameters:
  • query_string – The string to get results for. If None, or "", no query is passed in and all objects for the class will be returned.
  • start_index – The 1-based offset to fetch from. A pagesize of 100 is returned.
Returns:

The QueryResult entity as returned by the API, containing at most 100 results.

Raises:

Exception if [‘QueryResult’][‘Errors’] contains anything.

convert_from_query_result(results, full_objects=False)

Convert a set of Rally results into python objects.

Parameters:
  • results – An iterable of results from the Rally API.
  • full_objects – Boolean. If True, results is assumed to contain full objects as returned by the API when fetch=True is included in the URL. If False, the full object data is fetched using create_from_ref().
Returns:

A list of full BaseRallyModel inheriting python objects.

create_from_ref(reference)

Create an instance of cls by getting data for reference.

Parameters:reference – The full url reference to make an api call with.
Returns:A populated BaseRallyModel inheriting instance which matches the reference.
Raises:A ReferenceNotFoundException if we get any error back from the API.
delete()

Delete this object from Rally

delete_from_cache()

Remove this item from the cache

get_all(clauses=None)

Return all the items for the rally class.

Parameters:clauses – Optional parameter of a list of clauses to be and ed together by get_query_clauses().
Returns:A list of BaseRallyModel inheriting objects.
get_all_results_for_query(query_string)

Return all the results for the given query.

Increment the start argument until entire result set has been retrieved and return just the results.

Parameters:query_string – The query to filter results by. If None, all results are returned for the object.
Returns:A list of full object results (ie fetch=true is set in the API GET)
get_by_formatted_id(formatted_id)

Return all the objects by the given formatted_id.

Parameters:name – The name to search for. The get is performed by setting FormattedID=``formatted_id`` in the url.
Returns:A single BaseRallyModel inheriting object with the FormattedID = formatted_id. Or None if one cannot be found.
ref
set_cache_timeout(timeout)

Set the cache timeout for this object type.

Parameters:timeout – The timeout to set against this object type.
sub_objects_dynamic_loader = {}
title

Property for getting the title of an object.

Returns:The attribute found in the key _refObjectName in the data back from the API
update(**kwargs)

Update all the attributes in rally_data specified in kwargs.

update_rally(refresh=True)

Update or create self on Rally.

If there is no sign of a _ref internally, a create is sent, otherwise an update is sent.

Parameters:refresh – Used on creates. If True a fetch is performed after the object is created in Rally and self is populated with the new data.
Returns:The response from the server.
pyrally.models.Story

alias of HierarchicalRequirement

register.py

pyrally.register.register_type(class_type)[source]

settings.py