Skip to content

Commit

Permalink
Merge pull request #62 from abhinav-upadhyay/fix_opentsdb_reporter
Browse files Browse the repository at this point in the history
Decode the auth header string to utf-8 before making request
  • Loading branch information
omergertel authored Dec 4, 2018
2 parents db2bf6f + 0730cae commit a691743
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyformance/reporters/opentsdb_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def report_now(self, registry=None, timestamp=None):
data=json.dumps(metrics).encode("utf-8"),
headers={'content-type': "application/json"})
authentication_data = "{0}:{1}".format(self.application_name, self.write_key)
auth_header = base64.b64encode(bytes(authentication_data.encode("utf-8")))
auth_header = base64.b64encode(bytes(authentication_data.encode("utf-8"))).decode("utf-8")
request.add_header("Authorization", "Basic {0}".format(auth_header))
urllib.urlopen(request)
except Exception as e:
Expand Down

0 comments on commit a691743

Please sign in to comment.