Created
February 5, 2016 17:03
-
-
Save mrhanlon/9590e5b05cc507f6d83f to your computer and use it in GitHub Desktop.
A script to bootstrap testing Box.com interactions for DesignSafe-CI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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