an api client for the lunduke discourse
config | ||
examples | ||
lunduke | ||
scripts | ||
.gitignore | ||
pyproject.toml | ||
README.md |
lunduke-cli
A simple python api client for discourse, designed explicitly for the lunduke discourse message board, but it could be used with any discourse message board.
Requirements
- Python 3.12 (or better)
- Poetry 2.0 (or better)
Poetry's pyproject.toml handles all other requirements.
Initialization
$ poetry install
Usage
See the "examples" directory. However, there are some additional notes you will need, in order to make it work.
First, a keys
directory at the root of the project, where
you will store a user api key you have already generated. A
well formed api key should look something like this:
X4ktxE5tsvC+RcvjF9Pa1N//PWTgjAF1xx5UcuaHFVKu84A14n6stDheUxxx
xxx8xxxUbpVN3xOtDxxIg5sU4ZjAZ+LRyKxU9+ikQMqno4Spqb9SOrclxxxx
5Lo/6xkBB/xM9/Rxxx3I0ZAcvurYeIHkVQmSigmaPMJBjx/MKLMGdlVOq+is
mxu7qTQcl85E5k0MC86LNr5Ds4xUQXgIGVGVICxxxUMr2VxxxD9tglgG+9sL
VYFehH4HxxPxx67XRfrq8WxZjYRMHcWaGO4O03lQZwPEpIz7aL6D6wPNdCaq
nH9ivM/3MdEUOQZQuh8R+XJ9Ik7RlTLNVxx8bxTJ2X==
Second, you will need a file called config.toml
in the root
of the project. That file should look like this:
[user]
username = "joe-doakes"
[api]
key_file = "cli_key.txt"
host = "forum.wherever.com"
Then, you can run the test scripts either with or without poetry support:
$ poetry run python examples/check-key.py # for example
$ python examples/example.py # for example