Skip to content

Commit

Permalink
call extra api with headers included (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
alesbublik authored and Revolution1 committed Nov 17, 2018
1 parent cbcff39 commit 04253c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions etcd3/apis/extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def version(self):
:return: EtcdVersion
"""
resp = self._get(self._url('/version'))
resp = self._get(self._url('/version'), headers=self.headers)
self._raise_for_status(resp)
return EtcdVersion(**resp.json())

Expand All @@ -24,7 +24,7 @@ def health(self):
:return: EtcdVersion
"""
resp = self._get(self._url('/health'))
resp = self._get(self._url('/health'), headers=self.headers)
self._raise_for_status(resp)
return resp.json()['health']

Expand All @@ -34,7 +34,7 @@ def metrics_raw(self): # pragma: no cover
:return: str
"""
resp = self._get(self._url('/metrics'))
resp = self._get(self._url('/metrics'), headers=self.headers)
self._raise_for_status(resp)
metrics = resp.content
if not isinstance(metrics, six.text_type):
Expand Down
3 changes: 2 additions & 1 deletion etcd3/baseclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def _retrieve_version(self): # pragma: no cover
try:
import requests

r = requests.get(self._url('/version'), cert=self.cert, verify=self.verify, timeout=0.3) # 300ms will do
r = requests.get(self._url('/version'), cert=self.cert,
verify=self.verify, timeout=0.3, headers=self.headers) # 300ms will do
r.raise_for_status()
v = r.json()
self.cluster_version = v["etcdcluster"]
Expand Down

0 comments on commit 04253c6

Please sign in to comment.