maraujop/requests-oauth — Issue #18: Determining if consumer_key/secret exist
Author: michaelhelmick
Created: 2012-03-06 17:06:27+00:00
State: open

Say I set

```python
OAuthHook.consumer_key = 'my_consumer_key'
OAuthHook.consumer_secret = 'my_consumer_secret'
```

It'd be nice if there was a way to determine if consumer_key and consumer_secret were set.

In my case, I want to use a request.session with a hook-pre_request of OAuthHook() using the key/secret if they are set AND if the oauth_token/secret is set when someone initializes my class, I want to then have request.session use the hook-pre_request also passing the oauth_token/secret

Let me know if you need me to elaborate more?

Something like:

```python
if OAuthHook.consumer_key is not None and OAuthHook.consumer_secret is not None:
self.client = requests.session(hooks={'pre_request': OAuthHook()})

if oauth_token and oauth_secret: # These are the ones that are passed in my init from maybe a recored in the db
oauth_hook = OAuthHook(self.oauth_token, self.oauth_secret)
self.client = requests.session(hooks={'pre_request': oauth_hook})
```