code for a connection_id and lists their repositories through the Unified API.
Prerequisites
- Python 3.10+ installed.
- In the BundleUp dashboard, complete steps 1 to 3 of the Quickstart:
- a GitHub integration with the identifier
github, http://localhost:8000/callback(Django’s default port) registered under Auth → Redirect URIs,- an API key, and your Client ID from the Auth page.
- a GitHub integration with the identifier
Step 1: Create a Django project
If you don’t already have a Django project:Step 2: Install the BundleUp Python SDK
Install the official BundleUp SDK from PyPI:Step 3: Configure Django settings
Add Django view URLs and your environment configuration:- Create a
.envfile in your project root with:
.env
- Load these environment variables in
settings.py(you can use python-dotenv or your own loader). - In
bundleup_django/urls.py, add routes:
bundleup_django/urls.py
Step 4: Create the authorization link
Incore/views.py, add a view that builds the BundleUp authorization URL:
core/views.py
core/templates/home.html with:
core/templates/home.html
/callback.
Step 5: Handle the callback and fetch data
When BundleUp redirects back to/callback, it includes a one-time code query parameter. Your server exchanges it, using your API key, for a connection_id. The code expires after 5 minutes and can only be used once.
Add the callback view to core/views.py:
core/views.py
redirect_uri must be exactly the same value you used to start the flow. BundleUp rejects the exchange otherwise.core/templates/callback.html:
core/templates/callback.html
- The
codeproves the redirect came from a flow you started. On its own it is useless without your API key connection_idties a user + integration together- The Python SDK then makes authenticated calls using that connection
- You can fetch repositories, calendar events, files, contacts, etc., depending on the integration
Step 6: Run your development server
Start the Django server:Next steps
- Store the
connection_idagainst the signed-in user in your database, and reuse it. Don’t send the user through the flow again. - Pass a
statevalue when you build the authorization URL and check it in the callback, to protect against CSRF. See Connecting user accounts. - Pass an
external_id(your user ID) so you can find connections by user later. - Call the provider directly through the Proxy when you need something the Unified API doesn’t cover.
- See the full Python SDK reference.

