안녕하세요!
이 주제에 대해 말씀드립니다: Run Data Explorer queries with the Discourse API - #27
CURL 명령어를 Python으로 변환해 보았는데, 문법적으로는 모두 정상으로 보이지만 항상 404 에러가 발생합니다. 반면 CURL 명령어를 실행하면 200 응답을 받습니다. 혹시 제가 어디서 잘못하고 있는지 알아볼 수 있을까요? 제 Python 코드는 다음과 같습니다:
# 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)
도움 주시면 감사하겠습니다!