<p>I have installed the python kubernetes module via the instructions here <a href="https://github.com/kubernetes-client/python/blob/master/kubernetes/README.md" rel="nofollow noreferrer">https://github.com/kubernetes-client/python/blob/master/kubernetes/README.md</a> via pip install, but i still can not seem to run through their example since i get an attribute error.</p>

<p>Code:</p>

<pre><code>from __future__ import print_function
import time
import kubernetes.client
from kubernetes.client.rest import ApiException
from pprint import pprint

# Configure API key authorization: BearerToken
kubernetes.client.configuration.api_key['authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# kubernetes.client.configuration.api_key_prefix['authorization'] = 'Bearer'
# create an instance of the API class
api_instance = kubernetes.client.AdmissionregistrationApi()

try:
    api_response = api_instance.get_api_group()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AdmissionregistrationApi-&gt;get_api_group: %s\n" % e)
</code></pre>

<p>Error:</p>

<pre><code>Traceback (most recent call last):
  File "&lt;pyshell#3&gt;", line 1, in &lt;module&gt;
    kubernetes.client.configuration.api_key['authorization'] = 'YOUR_API_KEY'
AttributeError: module 'kubernetes.client.configuration' has no attribute 'api_key'
</code></pre>

BLang
<p>I think need to change the code a little bit
replace this line</p>
<pre><code>kubernetes.client.configuration.api_key['authorization'] = 'YOUR_API_KEY'
</code></pre>
<p>with</p>
<pre><code>configuration = kubernetes.client.Configuration()
configuration.api_key['authorization'] = 'YOUR_API_KEY'
</code></pre>
<p>see <a href="https://github.com/kubernetes-client/python/blob/7e4b80903677b791ea96af0c78fcc07e06038ac8/kubernetes/docs/AuthenticationV1Api.md" rel="nofollow noreferrer">here</a></p>
