basho/riak-python-client — pull request #295 by flashingpumpkin (2014-01-13 16:34:15+00:00)
Title: Added default_headers attribute to RiakHttpConnection

Because basho/riak#355 hasn't landed yet I've added this.

It allows one to set default HTTP headers which are used on each request, e.g. Authorization headers. This is useful when using Riak together with a [load balancer or proxy](http://docs.basho.com/riak/latest/ops/advanced/configs/load-balancing-proxy/) with basic auth.

Usage:

```python
import riak
headers = {'Authorization': 'Basic {}'.format('riak:example'.encode('base64')).strip()}
http = riak.RiakClient(http_port=8080, protocol='http', transport_options={'default_headers': headers})
https = riak.RiakClient(http_port=8088, protocol='https', transport_options={'default_headers': headers})
```