こんにちは!
このトピックについてです:Run Data Explorer queries with the Discourse API - #27
cURL コマンドを Python に移植しようと試みました。構文の観点からはすべて問題なさそうに見えるのですが、常に 404 エラーが発生します。一方、cURL コマンドを実行すると 200 が返ってきます。何が間違っているか分かる方がいらっしゃいますか?私の Python コードは以下の通りです:
# インポート
import requests
import json
# 定数
ENDPOINT = 'https://community.myCompanyName.com/admin/plugins/explorer/queries/73/run'
API_KEY = '<the_api_key>'
API_USERNAME = '<my_discourse_username>'
# コア関数
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)
ご協力ありがとうございます!