Quantcast
Channel: Access via Discourse API, key and/or user rejected
Viewing all articles
Browse latest Browse all 3

Access via Discourse API, key and/or user rejected

$
0
0

:+1: this works, you don’t know how much time I spent on this.

But the API endpoints are the same described here
https://docs.discourse.org/
?

(if yes, it would be great to mention not only how to authenticate with the admin API key but also mention the client API key)

For the pydiscourse client, there is a hacky workaround to use a different header:

from pydiscourse import DiscourseClient

client = DiscourseClient(
        'https://forum.example.com',
        api_username='tflidd',
        api_key='388b79103056fede1d3223dae032df99')

headers = {
            "Accept": "application/json; charset=utf-8",
            "User-Api-Key": '388b79103056fede1d3223dae032df99',
            "User-Api-Username": 'tflidd',
        }

slug = "abc"
topic_id = 1234

client.topic(slug=slug, topic_id=topic_id, override_request_kwargs=override_request_kwargs)

Read full topic


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images