mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-13 06:20:16 +02:00
Merge branch 'discourse' into 'master'
API Headers for Discourse See merge request allianceauth/allianceauth!1197
This commit is contained in:
commit
f1d5cc8903
@ -168,7 +168,7 @@ class DiscourseManager:
|
|||||||
for arg in kwargs:
|
for arg in kwargs:
|
||||||
if arg not in endpoint['args']['required'] and arg not in endpoint['args']['optional'] and not silent:
|
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))
|
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)
|
json=data)
|
||||||
try:
|
try:
|
||||||
if 'errors' in r.json() and not silent:
|
if 'errors' in r.json() and not silent:
|
||||||
@ -185,6 +185,7 @@ class DiscourseManager:
|
|||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
raise DiscourseError(endpoint, e.response.status_code)
|
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
|
return out
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user