Hallo!
Bezüglich dieses Themas: Run Data Explorer queries with the Discourse API - #27
Ich habe versucht, den CURL-Befehl nach Python zu portieren. Aus Syntax-Sicht scheint alles in Ordnung zu sein, aber ich bekomme jedes Mal einen 404-Fehler. Wenn ich jedoch den CURL-Befehl ausführe, erhalte ich eine 200-Antwort. Kann jemand von euch erkennen, was ich falsch mache? Hier ist mein Python-Code:
# Imports
import requests
import json
# Constants
ENDPOINT = 'https://community.myCompanyName.com/admin/plugins/explorer/queries/73/run'
API_KEY = '<the_api_key>'
API_USERNAME = '<my_discourse_username>'
# Core Functions
def send_request(endpoint):
api_keys = {'Api-Key': API_KEY, 'Api-Username': API_USERNAME}
headers = {'Content-Type': 'multipart/form-data'}
request = requests.post(endpoint, api_keys, headers)
print("STATUS CODE: %s" % request.status_code)
send_request(ENDPOINT)
Danke für die Hilfe!