diff --git a/HISTORY.md b/HISTORY.md index cbee5e0f2b4e28b037dfacfb31d50bfac2f4e117..09f16dd84c4df0968d2c6eca5ffb7b2410da61ec 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -13,5 +13,6 @@ - previous released packages where broken... ### release notes for 0.2.4 -- updated release notes +- setting the user-agent string to 'sch/{version}' when interacting with the + Healthchecks API - got rid of outdated development section in the readme diff --git a/sch/sch.py b/sch/sch.py index 360a772a85ce44bd2228283a69244d343c0879ba..458a1549d01927e6658838aed7b9b8c8f169c6bc 100644 --- a/sch/sch.py +++ b/sch/sch.py @@ -19,6 +19,7 @@ import requests import tzlocal from crontabs import CronTabs from ttictoc import TicToc +from . import __version__ HANDLER = logging.handlers.SysLogHandler('/dev/log') FORMATTER = logging.Formatter( @@ -221,7 +222,10 @@ class Healthchecks: """ def __init__(self, cred): self.cred = cred - self.auth_headers = {'X-Api-Key': self.cred.api_key} + self.auth_headers = { + 'X-Api-Key': self.cred.api_key, + 'User-Agent': 'sch/{version}'.format(version=__version__) + } def get_checks(self, query=''): """Returns a list of checks from the HC API"""