-
Notifications
You must be signed in to change notification settings - Fork 7
/
nodebb.py
34 lines (28 loc) · 999 Bytes
/
nodebb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://github.com/Linuxfabrik/monitoring-plugins/blob/main/CONTRIBUTING.rst
"""This library collects some NodeBB related functions that are
needed by more than one NodeBB plugin."""
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
__version__ = '2024031401'
from . import base
from . import url
def get_data(args, uri=''):
"""Fetch json from the NodeBB API using an user token. For details have a look at
https://docs.nodebb.org/api/
"""
return base.coe(url.fetch_json(
args.URL + uri,
header={
'Accept': 'application/json',
'Authorization': 'Bearer {}'.format(args.TOKEN),
},
insecure=args.INSECURE,
no_proxy=args.NO_PROXY,
timeout=args.TIMEOUT,
))