Box SDK¶
Description:
- Interact with data in box.com
Resources:
- https://developer.box.com/guides/authentication/jwt/jwt-setup/
- https://developer.box.com/reference/get-authorize/
- https://support.box.com/hc/en-us/articles/4636662134803-Creating-Your-Developer-Account
- https://app.box.com/developers/console
- https://developer.box.com/guides/tooling/sdks/
- https://box-python-sdk.readthedocs.io/en/latest/boxsdk.object.html
Environment variables¶
This notebook reads its settings from environment variables. Set them before starting Jupyter:
BOX_CLIENT_ID: client ID of your Box appBOX_CLIENT_SECRET: client secret of your Box appBOX_ACCESS_TOKEN: a Box developer or OAuth access tokenBOX_FOLDER_ID: optional, the folder to open; defaults to0(the root folder)
In [ ]:
Copied!
import os
import fsspec
from boxsdk import Client, OAuth2
oauth = OAuth2(
client_id=os.environ["BOX_CLIENT_ID"],
client_secret=os.environ["BOX_CLIENT_SECRET"],
access_token=os.environ["BOX_ACCESS_TOKEN"],
)
client = Client(oauth)
client.folder(os.environ.get("BOX_FOLDER_ID", "0"))
import os
import fsspec
from boxsdk import Client, OAuth2
oauth = OAuth2(
client_id=os.environ["BOX_CLIENT_ID"],
client_secret=os.environ["BOX_CLIENT_SECRET"],
access_token=os.environ["BOX_ACCESS_TOKEN"],
)
client = Client(oauth)
client.folder(os.environ.get("BOX_FOLDER_ID", "0"))