Metadata-Version: 2.1
Name: box-oauth
Version: 0.2.5
Summary: Box headless OAuth2 client
Home-page: UNKNOWN
Author: Gabriel Abud
Author-email: gabriel.jabud@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Description-Content-Type: text/markdown
Requires-Dist: appnope (==0.1.0)
Requires-Dist: asn1crypto (==0.24.0)
Requires-Dist: atomicwrites (==1.3.0)
Requires-Dist: attrs (==19.1.0)
Requires-Dist: autopep8 (==1.4.3)
Requires-Dist: backcall (==0.1.0)
Requires-Dist: boxsdk (==2.3.2)
Requires-Dist: certifi (==2019.3.9)
Requires-Dist: cffi (==1.12.2)
Requires-Dist: chardet (==3.0.4)
Requires-Dist: cryptography (==2.6.1)
Requires-Dist: decorator (==4.4.0)
Requires-Dist: entrypoints (==0.3)
Requires-Dist: idna (==2.8)
Requires-Dist: ipykernel (==5.1.0)
Requires-Dist: ipython (==7.4.0)
Requires-Dist: ipython-genutils (==0.2.0)
Requires-Dist: jedi (==0.13.3)
Requires-Dist: jupyter-client (==5.2.4)
Requires-Dist: jupyter-core (==4.4.0)
Requires-Dist: keyring (==19.0.1)
Requires-Dist: more-itertools (==7.0.0)
Requires-Dist: parso (==0.4.0)
Requires-Dist: pexpect (==4.7.0)
Requires-Dist: pickleshare (==0.7.5)
Requires-Dist: pluggy (==0.9.0)
Requires-Dist: prompt-toolkit (==2.0.9)
Requires-Dist: ptyprocess (==0.6.0)
Requires-Dist: py (==1.8.0)
Requires-Dist: pycodestyle (==2.5.0)
Requires-Dist: pycparser (==2.19)
Requires-Dist: Pygments (==2.3.1)
Requires-Dist: PyJWT (==1.7.1)
Requires-Dist: pytest (==4.4.0)
Requires-Dist: python-dateutil (==2.8.0)
Requires-Dist: pyzmq (==18.0.1)
Requires-Dist: requests (==2.21.0)
Requires-Dist: requests-toolbelt (==0.9.1)
Requires-Dist: selenium (==3.141.0)
Requires-Dist: six (==1.12.0)
Requires-Dist: tornado (==6.0.2)
Requires-Dist: traitlets (==4.3.2)
Requires-Dist: urllib3 (==1.24.1)
Requires-Dist: wcwidth (==0.1.7)
Requires-Dist: wrapt (==1.11.1)

# Python OAuth2 Headless Client for Box

Python package to help connect with a Box API in cases where you don't have access to get the JWT file (better long term solution). In cases where you want to connect to the Box API through OAuth2 in a headless manner (without a browser) this can help

# Dependencies

This package depends on keyring, selenium, and boxsdk.  Since selenium runs in headless mode, you will need to make sure geckodriver is installed on your machine (this is done outside of pip unfortunately).

# Usage

Initial login
```
from box_auth.box_auth import BoxAuth

box = BoxAuth(
    client_id, # From Box developer console
    client_secret, # From box developer console
    box_username,
    box_password,
    user_email # This is used by your keyring
)

url = box.authorize() # This will generate a URL to authorize Box acess
code = box.grant_permissions(url) # Okay access and get the code 

box.authenticate(code) # Use code to get access and refresh tokens
box.login() # Login

print(box.get_current_user()) # Double check that it worked
```

Subsequent logins (assuming your refresh token hasn't expired, usually lasts 14 days)
```
box = BoxAuth(
    client_id, # From Box developer console
    client_secret, # From box developer console
    box_username,
    box_password,
    user_email # This is used by your keyring
)

box.login()
```

To get the [boxsdk](https://github.com/box/box-python-sdk) client, just run:
```
Client = box.get_client()
```

Follow the boxsdk documentation for how to use the client to access box

# Testing

You need the following variables in a config_test.py file (root directory) for the tests to work
```
client_id = # You can find this in the developer console, under your app configuration
client_secret =  # ""
box_username =
box_password
user_email # This is used by your keyring to store the access and refresh token
user # This is used by tests to check that you are the correct user
```

# Install

As a pip package
```
pip install box_oauth
```

or
```
python setup.py
```



