braintree/braintree_python — pull request #35 by poundifdef (2014-01-21 21:57:40+00:00)
Title: Fix AttributeError for use_unsafe_ssl option when instantiating config

Consider the following code (lifted from this stackoverflow post [1]):

```
import braintree

config = braintree.Configuration(
environment=braintree.Environment.Sandbox,
merchant_id='merchant_id',
public_key='public_key',
private_key='private_key'
)
gateway = braintree.BraintreeGateway(config)
result = gateway.transaction.create({
'amount': '10.00',
})
```

This results in the following exception:

```
jay@coltrane:~/github/braintree_python$ python test_braintree.py
Traceback (most recent call last):
File "test_braintree.py", line 14, in
'amount': '10.00',
File "/home/jay/github/braintree_python/braintree/transaction_gateway.py", line 33, in create
return self._post("/transactions", {"transaction": params})
File "/home/jay/github/braintree_python/braintree/transaction_gateway.py", line 137, in _post
response = self.config.http().post(url, params)
File "/home/jay/github/braintree_python/braintree/util/http.py", line 40, in post
return self.__http_do("POST", path, params)
File "/home/jay/github/braintree_python/braintree/util/http.py", line 52, in __http_do
http_strategy = self.config.http_strategy()
File "/home/jay/github/braintree_python/braintree/configuration.py", line 103, in http_strategy
if Configuration.use_unsafe_ssl:
AttributeError: type object 'Configuration' has no attribute 'use_unsafe_ssl'
```

This pull request fixes that. Some notes:

1. I tried to keep the same interface for specifying the `use_unsafe_url` option (statically) rather than adding it as an optional parameter in the constructor. I assume you do this because you don't really want people using this feature.

2. But I also realize there are other ways to have implemented this. So I'm open to using a different technique.

3. I tested this using a test script, because the current tests depend on a local dev server running. If you want, I can update `test_helper.py` with my sandbox credentials and try running tests.

4. Similarly, it looks like there are very few tests pertaining to this code path (of the `use_unsafe_ssl` option.) I'm happy to write some if I could have some guidance on the best way to do so.

Thank you!

Jay

[1] http://stackoverflow.com/a/21263451/3788