It would be a great help if somebody helps me to understand how the following command can be executed using python:

curl -X POST -H "Content-Type: application/json" -H "X-Insert-Key: YOUR_KEY_HERE" -d '{"eventType":"Custom Event Name", "attribute1": "value"}'

SQL query results need to be converted to JSON format and need to be pushed to new relic using the above command.

1 Answers

panda On

try doing this

import requests

headers = {
    'Content-Type': 'application/json',
    'X-Insert-Key': 'YOUR_KEY_HERE',

data = '{"eventType":"Custom Event Name", "attribute1": "value"}'

response ='', headers=headers, data=data)