Fail on HTTP error, include /v4 path in software
This commit is contained in:
parent
18e5b99988
commit
ced3864fb6
1 changed files with 3 additions and 2 deletions
|
@ -10,7 +10,7 @@ from pytz import utc
|
||||||
|
|
||||||
CHANNEL = os.environ["SUNBOT_ANNOUNCE_CHANNEL"]
|
CHANNEL = os.environ["SUNBOT_ANNOUNCE_CHANNEL"]
|
||||||
AUTHORIZATION = "Bearer " + os.environ["SUNBOT_ANNOUNCE_MATTERMOST_TOKEN"]
|
AUTHORIZATION = "Bearer " + os.environ["SUNBOT_ANNOUNCE_MATTERMOST_TOKEN"]
|
||||||
URL = os.environ["SUNBOT_ANNOUNCE_MATTERMOST_API_ENDPOINT"] + "/posts"
|
URL = os.environ["SUNBOT_ANNOUNCE_MATTERMOST_API_ENDPOINT"] + "/v4/posts"
|
||||||
|
|
||||||
LOCATION = astral.LocationInfo("Gent", "Belgium", "Europe/Brussels", 51.05, 3.72)
|
LOCATION = astral.LocationInfo("Gent", "Belgium", "Europe/Brussels", 51.05, 3.72)
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ def post(message):
|
||||||
"message": message
|
"message": message
|
||||||
}
|
}
|
||||||
print("Posting " + str(payload), flush=True)
|
print("Posting " + str(payload), flush=True)
|
||||||
requests.post(URL, json=payload, headers={"Authorization": AUTHORIZATION})
|
r = requests.post(URL, json=payload, headers={"Authorization": AUTHORIZATION})
|
||||||
|
r.raise_for_status()
|
||||||
|
|
||||||
|
|
||||||
def format_in(diff):
|
def format_in(diff):
|
||||||
|
|
Loading…
Reference in a new issue