[英]How to execute particular method say function2 in the following snippet or all three using command line arguments in python?
[英]How to execute the following command using Python?
如果有人帮助我了解如何使用 python 执行以下命令,那将是一个很大的帮助:
curl -X POST https://insights-collector.newrelic.com/v1/accounts/YOUR_ACCOUNT_ID/events -H "Content-Type: application/json" -H "X-Insert-Key: YOUR_KEY_HERE" -d '{" eventType":"自定义事件名称", "attribute1": "value"}'
SQL查询结果需要转换为JSON格式,需要使用上述命令推送到新的relic。
尝试这样做
import requests
headers = {
'Content-Type': 'application/json',
'X-Insert-Key': 'YOUR_KEY_HERE',
}
data = '{"eventType":"Custom Event Name", "attribute1": "value"}'
response = requests.post('https://insights-collector.newrelic.com/v1/accounts/YOUR_ACCOUNT_ID/events', headers=headers, data=data)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.