Give AlbumentationsX a star on GitHub — it powers this leaderboard

Star on GitHub

boxsdk

Official Box Python SDK

Rank: #2093Downloads: 3,404,000 (30 days)Stars: 453Forks: 219

Description

<p align="center"> <img src="https://github.com/box/sdks/blob/master/images/box-dev-logo.png" alt= “box-dev-logo” width="30%" height="50%"> </p>

Box Python SDK v10

Project Status build PyPI version image Platform Coverage

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->

Introduction

We are excited to introduce the v10 major release of the Box Python SDK, designed to elevate the developer experience and streamline your integration with the Box Content Cloud.

With this SDK version, we provide the box_sdk_gen package, which gives you access to:

  1. Full API Support: The new generation of Box SDKs empowers developers with complete coverage of the Box API ecosystem. You can now access all the latest features and functionalities offered by Box, allowing you to build even more sophisticated and feature-rich applications.
  2. Rapid API Updates: Say goodbye to waiting for new Box APIs to be incorporated into the SDK. With our new auto-generation development approach, we can now add new Box APIs to the SDK at a much faster pace (in a matter of days). This means you can leverage the most up-to-date features in your applications without delay.
  3. Embedded Documentation: We understand that easy access to information is crucial for developers. With our new approach, we have included comprehensive documentation for all objects and parameters directly in the source code of the SDK. This means you no longer need to look up this information on the developer portal, saving you time and streamlining your development process.
  4. Enhanced Convenience Methods: Our commitment to enhancing your development experience continues with the introduction of convenience methods. These methods cover various aspects such as chunk uploads, classification, and much more.
  5. Seamless Start: The new SDKs integrate essential functionalities like authentication, automatic retries with exponential backoff, exception handling, request cancellation, and type checking, enabling you to focus solely on your application's business logic.

Embrace the new generation of Box SDKs and unlock the full potential of the Box Content Cloud.

Supported versions

To enhance developer experience, we have introduced the new generated codebase through the box_sdk_gen package. The box_sdk_gen package is available in two major supported versions: v4 and v10.

Version v4

In v4 of the Box Python SDK, we are introducing a version that consolidates both the manually written package (boxsdk) and the new generated package (box_sdk_gen). This allows developers to use both packages simultaneously within a single project.

The codebase for v4 of the Box Python SDK is currently available on the combined-sdk branch. Migration guide which would help with migration from boxsdk to box_sdk_gen can be found here.

Version v4 is intended for:

  • Existing developers of the Box Python SDK v3 who want to access new API features while keeping their current codebase largely unchanged.
  • Existing developers who are in the process of migrating to box_sdk_gen, but do not want to move all their code to the new package immediately.

Version v10

Starting with v10, the SDK is built entirely on the generated box_sdk_gen package, which fully and exclusively replaces the old boxsdk package. The codebase for v10 of the Box Python SDK is currently available on the main branch.

Version v10 is intended for:

  • New users of the Box Python SDK.
  • Developers already working with the generated Box Python SDK previously available under the Box Python SDK Gen repository.

Which Version Should I Use?

ScenarioRecommended VersionExample pip install
Creating a new applicationUse v10pip install "boxsdk>=10"
App using box-sdk-gen artifactMigrate to v10pip install "boxsdk>=10"
App using both box-sdk-gen and boxsdk artifactsUpgrade to v4pip install "boxsdk~=4.0"
App using v3 of boxsdk artifactUpgrade to v4pip install "boxsdk~=4.0"

For full guidance on SDK versioning, see the Box SDK Versioning Guide.

Installing

The next generation of the SDK starts with version 10.0.0.

pip install boxsdk>=10

This is autogenerated Box SDK version. Supported Python versions are Python 3.8 and above.

To install also extra dependencies required for JWT authentication, use command:

pip install "boxsdk[jwt]>=10"

Getting Started

To get started with the SDK, get a Developer Token from the Configuration page of your app in the Box Developer Console. You can use this token to make test calls for your own Box account.

The SDK provides an BoxDeveloperTokenAuth class, which allows you to authenticate using your Developer Token. Use instance of BoxDeveloperTokenAuth to initialize BoxClient object. Using BoxClient object you can access managers, which allow you to perform some operations on your Box account.

The example below demonstrates how to authenticate with Developer Token and print names of all items inside a root folder.

from box_sdk_gen import BoxClient, BoxDeveloperTokenAuth

def main(token: str):
    auth: BoxDeveloperTokenAuth = BoxDeveloperTokenAuth(token=token)
    client: BoxClient = BoxClient(auth=auth)
    for item in client.folders.get_folder_items('0').entries:
        print(item.name)

if __name__ == '__main__':
    main('INSERT YOUR DEVELOPER TOKEN HERE')

Authentication

Box Python SDK v10 supports multiple authentication methods including Developer Token, OAuth 2.0, Client Credentials Grant, and JSON Web Token (JWT).

You can find detailed instructions and example code for each authentication method in Authentication document.

Documentation

Browse the docs or see API Reference for more information.

Migration guides

Migration guides which help you to migrate to supported major SDK versions can be found here.

Versioning

We use a modified version of Semantic Versioning for all changes. See version strategy for details which is effective from 30 July 2022.

A current release is on the leading edge of our SDK development, and is intended for customers who are in active development and want the latest and greatest features.
Instead of stating a release date for a new feature, we set a fixed minor or patch release cadence of maximum 2-3 months (while we may release more often). At the same time, there is no schedule for major or breaking release. Instead, we will communicate one quarter in advance the upcoming breaking change to allow customers to plan for the upgrade.

We always recommend that all users run the latest available minor release for whatever major version is in use. We highly recommend upgrading to the latest SDK major release at the earliest convenient time and before the EOL date.

Version schedule

VersionSupported EnvironmentsStateFirst ReleaseEOL/Terminated
10Python 3.8+Supported17 Sep 2025TBD
4Python 3.8+Supported23 Oct 20252027 or v5 is