whistleblower / api.py
FireShadow's picture
base code added
098a230 verified
raw
history blame
323 Bytes
import requests
def call_external_api(url, message, request_body , response_body , api_key=None):
headers = {'X-repello-api-key': f'{api_key}'} if api_key else {}
response = requests.post(url, json={request_body: message}, headers=headers)
response.raise_for_status()
return response.json()[response_body]