Skip to main content
This guide builds the Quickstart flow into a Django app with the BundleUp Python SDK. A user clicks Connect GitHub, authorizes on GitHub, and lands back in your app, which exchanges the one-time 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.

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:
This package lets your Django server use the BundleUp Unified API to fetch data after a user has authorized an integration.

Step 3: Configure Django settings

Add Django view URLs and your environment configuration:
  1. Create a .env file in your project root with:
.env
  1. Load these environment variables in settings.py (you can use python-dotenv or your own loader).
  2. In bundleup_django/urls.py, add routes:
bundleup_django/urls.py
In core/views.py, add a view that builds the BundleUp authorization URL:
core/views.py
Create a simple template core/templates/home.html with:
core/templates/home.html
Clicking this link sends users to authorize GitHub, and then they’re redirected back to /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.
And in core/templates/callback.html:
core/templates/callback.html
What’s happening here
  • The code proves the redirect came from a flow you started. On its own it is useless without your API key
  • connection_id ties 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:
Visit http://localhost:8000, click Connect GitHub, authorize, and you’ll see a list of repositories.

Next steps

  • Store the connection_id against the signed-in user in your database, and reuse it. Don’t send the user through the flow again.
  • Pass a state value 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.