Skip to main content

BasecamPY3

An easy-to-use Python interface to the Basecamp 3 API.

While BasecamPY3 aims to be equally functional in Python 2.7, the majority of testing has been in Python 3.4+ during this early stage of its development.

Features

  • Easy, AWS CLI-like configuration and installation
  • Object-oriented API
  • Handles rate-limiting, caching, and authentication for you!

Install

pip install basecampy3
bc3 configure

Follow the prompts to obtain an access and refresh token which is then saved to ~/.config/basecamp.conf, allowing you to call Basecamp3() without any parameters. You will need to make your own Basecamp 3 app integration first.

Storing in environment variables

Once you have the credentials you can store them in environment variables:

  • BASECAMP_CLIENT_ID
  • BASECAMP_CLIENT_SECRET
  • BASECAMP_REDIRECT_URL
  • BASECAMP_ACCESS_TOKEN
  • BASECAMP_REFRESH_TOKEN

This will allow to easier deploys using CI, initializing with:

from basecampy3 import Basecamp3

bc3 = Basecamp3.from_environment()

Usage

Basic Example

from basecampy3 import Basecamp3

bc3 = Basecamp3()

for project in bc3.projects.list():
    print(project.name)

new_project = bc3.projects.create("My New Project", description="The best project ever made.")
new_project.campfire.post_message("Hello World!")
new_message = new_project.message_board.post_message("Check this out", content="This is a new message thread start.")
new_message.archive()

todolist = new_project.todoset.create("Things to be done")
todolist.create("Get Milk")
todolist.create("Get Eggs")
go_to_bed = todolist.create("Go to bed.")
go_to_bed.check()  # this is marked as done

Not all functionality of the API is available yet. For anything missing, you can use the requests Session object yourself directly and consult the Basecamp 3 API docs. The benefit of using this Session object is you will benefit from the authentication, rate-limiting, and caching features.

Direct Session Example

from basecampy3 import Basecamp3
import json

bc3 = Basecamp3()
session = bc3.session

# replace these with actual IDs of the Basecamp objects you wish to get
MY_COMPANY_ID = 1234567
recording_id = 123456789
project_id = 1234567

# Reference:
# https://github.com/basecamp/bc3-api/blob/master/sections/comments.md#get-comments
BASE_URL = "https://3.basecampapi.com/{company_id}".format(company_id=MY_COMPANY_ID)  # base of all API requests
ENDPOINT = "{base_url}/buckets/{project_id}/recordings/{recording_id}/comments.json"  # get comments endpoint
url = ENDPOINT.format(base_url=BASE_URL, project_id=project_id, recording_id=recording_id)
resp = session.get(url)  # make a GET request. Substitute get() with post() or put() or delete() as needed
if not resp.ok:  # API returned a 4XX or 5XX error
    print("Something went wrong.")
data = resp.json()
pretty_print = json.dumps(data, indent=4)
print(pretty_print)

CLI Example

COMING SOON! Command Line interface for doing stuff with Basecamp. (not working yet)

  $ bc3 copy-access 12341234 87658765  # give user 87658765 access to all the projects that 12341234 does

Todo

  • The rest of the Basecamp 3 API
  • Command line tool (beyond just the "configure" command)
  • Better testing coverage

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

basecampy3-0.7.2.tar.gz (56.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

basecampy3-0.7.2-py3-none-any.whl (88.9 kB view details)

Uploaded Python 3

basecampy3-0.7.2-py2-none-any.whl (88.9 kB view details)

Uploaded Python 2

File details

Details for the file basecampy3-0.7.2.tar.gz.

File metadata

  • Download URL: basecampy3-0.7.2.tar.gz
  • Upload date:
  • Size: 56.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for basecampy3-0.7.2.tar.gz
Algorithm Hash digest
SHA256 af11d59245b464f978e274278306b75995b984000a1250a403b49ed799fc4e01
MD5 a3f1e6dea926a1277cc340cf92f06690
BLAKE2b-256 90eafc0a5869aecb9ead49dc8c1f73d3ebe66cb977948bdc64778090060b1c18

See more details on using hashes here.

File details

Details for the file basecampy3-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: basecampy3-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 88.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for basecampy3-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2be503a6cf9d15b06cb9e4bdf7c9d5535467dc6e765e416ba3f54d00982b9f39
MD5 cbb381126d566f96880216f0e0f6cf7a
BLAKE2b-256 e1c6d9d291061b898178d1a3fb3a412d23b0570e193ae85e2380ffca8b9ece0e

See more details on using hashes here.

File details

Details for the file basecampy3-0.7.2-py2-none-any.whl.

File metadata

  • Download URL: basecampy3-0.7.2-py2-none-any.whl
  • Upload date:
  • Size: 88.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for basecampy3-0.7.2-py2-none-any.whl
Algorithm Hash digest
SHA256 f90baaae4ab58627eebb4fba0706c3d7333f7f603304bdc8101ce3e5275fdaf5
MD5 b2a9a4d1c500efb7303225e3e28f04c9
BLAKE2b-256 597236afa6d18714a16324cceadbcc5a13ae28d3bff5fc41ac32932c44aa1f0f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.7.2 This release

3 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

1 file

0.3.0

1 file

0.2.2

1 file

0.1.6

1 file

0.1.5

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page