From f70fbbdfeebd9b1b5f6074fa9eb1c743e184505e Mon Sep 17 00:00:00 2001 From: AaronKable Date: Mon, 27 Apr 2020 14:37:01 +0800 Subject: [PATCH 1/2] headers for Discourse --- allianceauth/services/modules/discourse/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allianceauth/services/modules/discourse/manager.py b/allianceauth/services/modules/discourse/manager.py index 4a0e0a41..14095512 100644 --- a/allianceauth/services/modules/discourse/manager.py +++ b/allianceauth/services/modules/discourse/manager.py @@ -168,7 +168,7 @@ class DiscourseManager: for arg in kwargs: if arg not in endpoint['args']['required'] and arg not in endpoint['args']['optional'] and not silent: logger.warn("Received unrecognized kwarg %s for endpoint %s" % (arg, endpoint)) - r = getattr(requests, endpoint['method'])(settings.DISCOURSE_URL + endpoint['parsed_url'], params=params, + r = getattr(requests, endpoint['method'])(settings.DISCOURSE_URL + endpoint['parsed_url'], headers=params, json=data) try: if 'errors' in r.json() and not silent: From 543fa3cfa9e7740ce92032207849958d44e4d1a9 Mon Sep 17 00:00:00 2001 From: AaronKable Date: Fri, 8 May 2020 10:03:05 +0800 Subject: [PATCH 2/2] extra logging for tests --- allianceauth/services/modules/discourse/manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/allianceauth/services/modules/discourse/manager.py b/allianceauth/services/modules/discourse/manager.py index 14095512..a6d99574 100644 --- a/allianceauth/services/modules/discourse/manager.py +++ b/allianceauth/services/modules/discourse/manager.py @@ -185,6 +185,7 @@ class DiscourseManager: r.raise_for_status() except requests.exceptions.HTTPError as e: raise DiscourseError(endpoint, e.response.status_code) + logger.debug("Discourse API output:\n{}".format(out)) # this is spamy as hell remove before release return out @staticmethod