freshbooks/refreshbooks — Issue #11: Reduce dependencies on 3rd-party modules
Author: benhoyt
Created: 2012-01-31 17:33:21+00:00
State: open

In some setups it's not trivial to install and deploy 3rd-party modules, such `httplib2` and `functional` and `oauth`.

Stripe.com's API has [a good approach](https://github.com/stripe/stripe-python/blob/master/stripe/__init__.py) with the likes of `httplib2`. Try importing `httplib2`, and if it won't import, fall back to `urllib2` (perhaps with a warning like Stripe does, as urllib2 doesn't verify SSL certificates). Requires a tiny wrapper, but the actual HTTP part of the API is pretty small.

Dependence on `functional` can be removed simply by replacing `default_response_decoder` with a standard Python function, or a lambda.

Dependence on `oauth` -- this module could be imported at runtime so that it's only required if you use OAuth authentication.

Dependence on `lxml` is quite baked into `refreshbooks`, so this probably shouldn't / can't be changed at this stage.