Projects¶
Create, edit, list, delete and archive projects in a Basecamp account.
See the Basecamp API docs for more info.
An access_token
is needed to perform any tasks within this class.
-
class
basecamp.projects.
Project
(account_url, access_token, refresh_token=None)¶ Operations on Projects in the API
-
archive
(project_id, archive=True)¶ Archive or unarchive a project.
Parameters: - project_id – project id to archive or unarchive
- archive – boolean True to archive, False to unarchive
Rtype dictionary: Dictionary of project details.
>>> import basecamp.api >>> account_url = 'https://basecamp.com/12345/api/v1' >>> access_token = 'access_token' >>> api = basecamp.api.Project(account_url, access_token) >>> projects = projects.archive(675, archive=True)
-
create
(name, description)¶ Create a new project in a basecamp account.
Parameters: - name – New project name.
- description – New project description.
Rtype dictionary: Project details dictionary.
>>> import basecamp.api >>> account_url = 'https://basecamp.com/12345/api/v1' >>> access_token = 'access_token' >>> api = basecamp.api.Project(account_url, access_token) >>> projects = projects.create('My Favorites Things', 'John Coltrane')
-
fetch
(project=None, archived=False)¶ Get a project, or a list of projects.
Parameters: - project – project id or None
- archived – True or False - By default, non-archived projects are not included in the list of projects returned.
Rtype dictionary: dictionary of projects see the following for the returned structure.
>>> import basecamp.api >>> account_url = 'https://basecamp.com/12345/api/v1' >>> access_token = 'access_token' >>> api = basecamp.api.Project(account_url, access_token) >>> projects = projects.fetch()
-
remove
(project_id)¶ Remove a project
Parameters: project_id – id of the project to delete. Return type: True if the project is removed, otherwise a BasecampAPIError
exception.>>> import basecamp.api >>> account_url = 'https://basecamp.com/12345/api/v1' >>> access_token = 'access_token' >>> api = basecamp.api.Project(account_url, access_token) >>> projects = projects.remove(675)
-
update
(project_id, name, description)¶ Update an existing basecamp project.
Parameters: - project_id – integer of project id to update.
- name – project name
- description – project description.
Rtype dictionary: Dictionary of project details.
>>> import basecamp.api >>> account_url = 'https://basecamp.com/12345/api/v1' >>> access_token = 'access_token' >>> api = basecamp.api.Project(account_url, access_token) >>> projects = projects.update(675, 'Giant Steps', 'John Coltrane')
-