Python wrapper for the Assembla API
Pull request Compare This branch is 12 commits ahead, 142 commits behind markfinger:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Assembla: Python wrapper for Assembla's RESTful API

An easy to use wrapper around the Assembla API.

Basic Example

from assembla import API

assembla = API(auth=('Username', 'Password',))

print'Big Project').ticket(number=201).status_name

Examples for Spaces

# Retrieve your available spaces
spaces = assembla.spaces()

# Select a specific space
space ='Big Project')

# Retrieve the space's milestones
milestones = space.milestones()

# Retrieve a specific milestone from the space
milestone = space.milestone('Release Candidate 1')

# Retrieve all of the space's tickets
tickets =

# Retrieve the space's tickets which are awaiting testing
tickets ='Test')

# Retrieve a specific ticket from the space
ticket = space.ticket(number=301)

# Retrieve all of the space's users
users = space.users()

# Retrieve a specific user from the space
user = space.user(name='John Smith')

Examples for Milestones

# Select a specific milestone
milestone ='Big Project').milestone('Release Candidate 1')

# Retrieve the milestone's tickets
tickets =

# Retrieve a specific ticket from the milestone
ticket = milestone.ticket(number=301)

# Retrieve the milestone's users
users = milestone.users()

# Retrieve a specific user from the milestone
user = milestone.user(name='John Smith')

Examples for Users

# Select a specific user
user ='Big Project').user(name='John Smith')

# Retrieve the user's tickets
tickets =

# Retrieve a specific ticket from the user
ticket = user.ticket(status_name='Test')

Examples for Tickets

# Retrieve a specific ticket
ticket = space.ticket(number=201)

# Retrieve all tickets awaiting code review
tickets ='Code Review')

# Retrieve all tickets assigned to an individual which are of a certain priority
# and awaiting testing
tickets =,

Example for Tasks

# Retrieve tasks for a user.
api = API(auth, use_cache=False)
tasks = api.tasks()
spaces = api.spaces()

# Retrieve the total hours, for which an
# individual has worked in a space!
for space in spaces:
    total_hours = 0
    for task in tasks:
        if task.space_id ==
            total_hours += task.hours
    print total_hours

Example for Stream

# Retrieve the Stream Events.
# These are similar to those appearing on (right side)

from datetime import datetime, date, timedelta
from dateutil import tz
from dateutil.parser import parse

api = API(auth, use_cache=False)
events =
spaces = api.spaces()
local_zone = tz.tzlocal()

# Retrieve the events happened in all spaces for an Organization, for a day.

tday =
tday = tday.replace(tzinfo=local_zone)
this_day = (tday - timedelta(hours=24)).date()
print 'Agiliq-Assembla Summary for the day ', tday.strftime("%b %d %Y")

for event in events:
    event_date_time = parse(
    event_date_time = event_date_time.astimezone(local_zone)
    event_date =
    if not event_date > this_day:
    for space in spaces:
        for user in space.users():
            if ==['id'] and['id'] ==
                print '\n', event_date_time.strftime("%H:%M"), \
      ['name'], '@',, event.operation, \
                '\n', event.title, '\n', event.url, '\n'
                if event.object == 'Ticket' and event.operation != 'created':
                    if getattr(event, 'whatchanged', None):
                        print event.whatchanged
                    elif getattr(event, 'comment_or_description', None):
                        print event.comment_or_description

#You can use smtplib module to send a summary email for a day.

Model Reference

All models (Space, Milestone, User and Ticket) are returned with fields corresponding to the data from Assembla. Naming conventions generally follow Assembla's API Reference. Where possible, values are coerced to native Python types.


Spaces have an in-memory caching system, which reduces the overheard on repeated requests to Assembla. By default, it is activated. You can deactivate it:

# Deactivate the cache for a space, all subsequent requests will return fresh data

# Deactivate the cache for all spaces instantiated from `assembla`
assembla = API(auth=('Username', 'Password',), use_cache=False)

If you want to purge stale data from a space's cache and begin refilling it:

# Purge stale data from the space's cache, any subsequent request will update the cache

Original Source:

Tasks API, Stream API, added in this Source: