Git Product home page Git Product logo

box-python-gen-workshop's Introduction

“box-dev-logo”

Box Python Workshops

This project contains workshops on how to use the Box Python SDK to interact with the Box API.

Box configuration steps

  1. Create a Box free account if you don't already have one.
  2. Complete the registration process for a Box developer account.
  3. Making sure you're logged in navigate to the Box Developer Console. This will activate your developer account.
  4. Create a new Box application. Select Custom App, fill in the form and then click Next.
  5. Select User Authentication (OAuth 2.0) and then click Create App.
  6. Scroll down to Redirect URIs and add the following redirect URI:
  7. Check all boxes in application scopes.
    • (or only what you think will be necessary)
  8. Click Save Changes.
  9. Note the Client ID and Client Secret. You will need these later.

Installation and configuration

Get the code

git clone [email protected]:barduinor/box-python-gen-workshop.git
cd box-python-gen-workshop

Set up your virtual environment

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

Create your local application environment file

cp sample_oauth.env .oauth.env

Open the code in the code editor of your choice.

code .

Update the CLIENT_ID and CLIENT_SECRET field values in the env file with the Box application client id and client secret you created on the developer console. Depending on the workshop you are working on, you may need to update other environment variables in the .env file.

# Common settings
CLIENT_ID = YOUR_CLIENT_ID
CLIENT_SECRET = YOU_CLIENT_SECRET

# OAuth2 settings
CALLBACK_HOSTNAME = 127.0.0.1
CALLBACK_PORT = 5000
REDIRECT_URI = http://127.0.0.1:5000/callback

Test the application

Depending on the type of authentication you'll be using test the associated files.

python test_oauth.py

The first time you run the application, it should open a web browser window and prompt you to log in to Box. After you log in, it will ask you to authorize the application. Once this process is complete you can close the browser window. By default the sample app prints the current user's name to the console, and lists the items on the root folder.

The authorization token last for 60 minutes, and the refresh toke for 60 days. If you get stuck, you can delete the .oauth.tk.db file and reauthorize the application.

JWT or CCG authentication will not require you to log in to Box.

Questions

If you get stuck or have questions, make sure to ask on our Box Developer Forum

Workshops

You'll find the workshop exercises in the workshops folder.

box-python-gen-workshop's People

Contributors

barduinor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.