Saturday, June 2, 2012

Box.com SDK for Python

The logo I made for the box.com SDK for Python


I just built the Python SDK of Box.com v2 REST API for fun on this Fri, it is the first SDK I built, before this, I never implement any SDK, since there is no chance to build it, the service I'm developing with already has good SDKs for their developer service, like Facebook, Dropbox, Plurk, Google Plus .. blah.


Fortunately, Box.com just changed their API to version second, with the RESTful feature, and still in the development, so they didn't implement any SDK for their new API, even the documentation doesn't follow the real situation of their API, so I just made one.


Github link: https://github.com/littleq0903/box-python-sdk 



How to use this SDK?

Action

With this SDK, calling API function will be easier than requesting HTTP RESTful API directly, the requirements are:
  • Apply for a API key on Box.com
  • Get the auth token from user authentication

After getting auth token from user, you can use Box API as the user you are serving, access the data from Box.com, here comes an example:

import boxapi

api = boxapi.Session("Your-API-key", auth_token="User-Auth-Token")
api.action("/folders/0")

api.action() will return the response from Box.com API, and already translated it from JSON to Python's Dictionary format, then you can do whatever you want.


Contributing

This project is in the development, so any contribution or advise is welcome, the roadmap now is focus on the following things:
  • Upload file(s)
  • Download file(s)
  • Traversing the directory structure (deeply traverse)
  • More session's methods for simplify the progress of doing specify action on API
  • Exception handling 

No comments:

Post a Comment