Via a (python) script I would like to retrieve data from pages that are only accessible when logged in. Like for example https://community.nodebb.org/unread
In order to get access, the script needs to authenticate, but I have no idea how to do that. This was my attempt:
import requests
username = 'USERNAME'
password = 'PASSWORD'
url = 'https://community.nodebb.org/api/unread'
r = requests.get(url, auth=(username, password))
page = r.content
print(page)
which outputs:
b'{"status":{"code":"forbidden","message":"You are not authorised to make this call"},"response":{}}'
In some places here in the forum I read that you should do it with the write api plugin. However, this is deprecated, the new approach lacks clear documentation (at least for me) and besides, I don't understand how it should work if you can't install a plugin and generate tokens (as in the case of community.nodebb.org).
It would be very helpful if someone could provide a very simple code snippet that outlines how it should work.
Many thanks in advance!