Hey there!
Regarding this topic: Run Data Explorer queries with the Discourse API
I tried to ported the CURL command to Python and from the syntax perspective everything seems ok but I’m getting 404 all the times but when I run. the CURL command I receive 200. Can any of you guys spot what I’m doing wrong? Here’s my 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)
Thanks for help!