Skip to main content

“box-dev-logo”

Versioning Strategy

Starting with v10 of the SDK, we’ve introduced a new generated codebase designed to enhance your experience with the Box API.
It is currently available on the sdk-gen branch and uses the new box_sdk_gen package instead of the old boxsdk.

v10 is targeted at new users of Box Python SDK and users already working with the generated Box Python SDK previously available under the Box Python SDK Gen repository.

For users of v3 of the Box Python SDK, no action is required at this time — we’ll be providing an upcoming v4 release that will include both boxsdk and box_sdk_gen packages for a smooth migration path. To avoid unintentional upgrades, pin your version to boxsdk~=3.0.

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


Which Version Should I Use?

Scenario Recommended Version Example pip install
Creating a new application Use v10 pip install "boxsdk>=10"
Existing app using box-sdk-gen artifact Upgrade to v10 pip install "boxsdk>=10"
Existing app using boxsdk artifact planning to use new features Wait for v4 to start migration process TBD
Existing app using boxsdk artifact not planning any changes Stay on boxsdk~=3.0 pip install "boxsdk~=3.0"

Box Python SDK

Project Status build PyPI version image Platform Coverage

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

With this SDK, you’ll have 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.

Table of contents

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')

Documentation

Browse the docs or see API Reference for more information.

Upgrades

The SDK is updated regularly to include new features, enhancements, and bug fixes. If you are upgrading from manual v3 SDK version to this new generated v10, checkout the migration guide and changelog for more information.

Integration Tests

Running integration tests locally

Create Platform Application

To run integration tests locally you will need a Custom App created in the Box Developer Console with Server Authentication (with JWT) selected as authentication method. Once created you can edit properties of the application:

  • In section App Access Level select App + Enterprise Access. You can enable all Application Scopes.
  • In section Advanced Features enable Make API calls using the as-user header and Generate user access tokens.

Now select Authorization and submit application to be reviewed by account admin.

Export configuration

  1. Select Configuration tab and in the bottom in the section App Settings download your app configuration settings as JSON.
  2. Encode configuration file to Base64, e.g. using command: base64 -i path_to_json_file
  3. Set environment variable: JWT_CONFIG_BASE_64 with base64 encoded jwt configuration file
  4. Set environment variable: BOX_FILE_REQUEST_ID with ID of file request already created in the user account, BOX_EXTERNAL_USER_EMAIL with email of free external user which not belongs to any enterprise and BOX_EXTERNAL_USER_ID with its ID.
  5. Set environment variable: WORKFLOW_FOLDER_ID with the ID of the Relay workflow that deletes the file that triggered the workflow. The workflow should have a manual start to be able to start it from the API.
  6. Set environment variable: APP_ITEM_ASSOCIATION_FILE_ID to the ID of the file with associated app item and APP_ITEM_ASSOCIATION_FOLDER_ID to the ID of the folder with associated app item.
  7. Set environment variable: APP_ITEM_SHARED_LINK to the shared link associated with app item.
  8. Set environment variable: SLACK_AUTOMATION_USER_ID to the ID of the user responsible for the Slack automation, SLACK_ORG_ID to the ID of the Slack organization and SLACK_PARTNER_ITEM_ID to the ID of the Slack partner item.

Running tests

To run integration tests locally:

  1. pip install -r requirements-test.txt
  2. pytest

Questions, Bugs, and Feature Requests?

Need to contact us directly? Browse the issues tickets! Or, if that doesn't work, file a new one and we will get back to you. If you have general questions about the Box API, you can post to the Box Developer Forum.

Copyright and License

Copyright 2023 Box, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for boxsdk 10.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for boxsdk 10.0.1
File Size Uploaded Provenance Actions
boxsdk-10.0.1.tar.gz 256.9 kB Without provenance Details for boxsdk-10.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for boxsdk 10.0.1
File Interpreter ABI Platform Actions
boxsdk-10.0.1-py3-none-any.whl Python 3 none any Details for boxsdk-10.0.1-py3-none-any.whl

Total release size: 794.7 kB

Release files / boxsdk-10.0.1.tar.gz

Download URL boxsdk-10.0.1.tar.gz
Size 256.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b4177714764a866e4666e674564bb54d8acdbd75f872b43c9760e1ac3f26afb4
BLAKE2b-256 checksum
How to use checksums
5a203a52bbe88345910ba8c484df079be40abbae5d517f3d0277efd926aaacb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / boxsdk-10.0.1-py3-none-any.whl

Download URL boxsdk-10.0.1-py3-none-any.whl
Size 537.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
736a294f3a9f696cee3a8ff0ab5ea3cd763cc2754517252f4f55c10ef0b6f9bb
BLAKE2b-256 checksum
How to use checksums
171905667a19c1d7cd18eceb30bf74755bf47a4b8992b68a5947d66894652332
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Security for boxsdk 10.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

10.0.1 This release

2 release files No provenance

2.3.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page