Skip to content

Instantly share code, notes, and snippets.

@mrhanlon
Created February 5, 2016 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrhanlon/9590e5b05cc507f6d83f to your computer and use it in GitHub Desktop.
Save mrhanlon/9590e5b05cc507f6d83f to your computer and use it in GitHub Desktop.
A script to bootstrap testing Box.com interactions for DesignSafe-CI
from boxsdk import OAuth2, Client
from django.contrib.auth import get_user_model
from django.conf import settings
from designsafe.apps.box_integration.models import BoxUserToken
from designsafe.apps.box_integration.tasks import *
username = '<username>'
user = get_user_model().objects.get(username=username)
token = BoxUserToken.objects.get(user=user)
oauth = OAuth2(
client_id=settings.BOX_APP_CLIENT_ID,
client_secret=settings.BOX_APP_CLIENT_SECRET,
access_token=token.access_token,
refresh_token=token.refresh_token,
store_tokens=token.update_tokens)
client = Client(oauth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment