dropboxwsgi

WSGI-compatible HTTP interface to Dropbox
Download

dropboxwsgi Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Rian Hunter
  • Publisher web site:
  • https://github.com/rianhunter/

dropboxwsgi Tags


dropboxwsgi Description

dropboxwsgi is a Python package that provides a WSGI application that implements an HTTP interface into the Dropbox API. This package includes a server application, also called dropboxwsgi, that runs the WSGI application from the command line.This is useful in situations where you'd like to serve a web site out of your Dropbox, either to the world or in a private network. Compare this to the current solution of linking the Dropbox desktop client on your server and serving out of your Dropbox folder.This package also contains a caching middleware that will cache data from the Dropbox API onto the local disk (or whatever storage implementation you provide) to eliminate redundant data transfer between your server and Dropbox.By the way, this package also supports Python 3. Yay!InstallationInstallation is easy and fun: python setup.py installServer Application Usagedropboxwsgi is both a server application and a library. Let's try using it on the command line first:$ cat < < EOF > config.iniconsumer_key = < your_dropbox_api_key >consumer_secret = < your_dropbox_api_secret >access_type = app_folderhttp_root = http://localhost:8080listen = 8080EOF$ dropboxwsgi -c config.ini -l infoServer is running; using wsgiref serverPretty simple. Now point your browser to http://localhost:8080/. If you want to run this in production I recommend using the gevent WSGI server and using nginx as frontend proxy.Library UsageWSGI applications, like dropboxwsgi, have the benefit of being able to run in a variety of server environments. App Engine and Heroku come to mind but running it on your own VPS works too. Let's try it using the reference WSGI implementation included with Python:#!/usr/bin/pythonfrom wsgiref.simple_server import make_serverfrom dropboxwsgi.dropboxwsgi import make_app, MemoryCredStorageconfig = dict(http_root="http://localhost:8080", consumer_key="< your dropbox api key", consumer_secret="< your dropbox api secret >", access_type"dropbox or app_folder")app = make_app(config, MemoryCredStorage())make_server("", 8080, app).serve_forever()The vanilla WSGI application provides the standard HTTP caching headers (both ETag and Last-Modified) but otherwise doesn't litter the HTTP header space. This makes it so you can layer as much middleware as you want between the application and the server.ExtensibilityIf I haven't stressed it already enough quite yet, let me try once more. There are dozens of middleware packages available for WSGI and even more proxy servers that speak HTTP. Extending dropboxwsgi is simply a matter of hooking things together. Do you want a caching Dropbox-backed server with HTTP auth? Squid + nginx + dropboxwsgi solves your problem. The possibilities are endless!Product's homepage


dropboxwsgi Related Software