Skip to content

Commit 4a3d2c8

Browse files
committed
[Fix] Regression on authentication header using python 2
1 parent c229ef7 commit 4a3d2c8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lnetatmo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,10 @@ def postRequest(topic, url, params=None, timeout=10):
826826
return None
827827
else:
828828
if params:
829+
token = params.pop("access_token") if "access_token" in params else None
829830
params = urlencode(params)
830831
headers = {"Content-Type" : "application/x-www-form-urlencoded;charset=utf-8"}
831-
if "access_token" in params:
832-
headers["Authorization"] = "Bearer %s" % params.pop("access_token")
832+
if token: headers["Authorization"] = "Bearer %s" % token
833833
req = urllib2.Request(url=url, data=params, headers=headers) if params else urllib2.Request(url)
834834
try:
835835
resp = urllib2.urlopen(req, timeout=timeout)

samples/rawAPIsample.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)