Grafana, python, and POST newline characters

In my ideal state, I'm able to do this via the python "requests" package, though I wouldn't mind if I had to do this via the "elasticsearch" package. I tried via ndjson as well, but couldn't make any progress.

I need an API Gateway to act as an intermediary between Grafana and an AWS installation of Elasticsearch, which means I need Signature 4 signing. Getting it to work with "GET" signed requests was no problem; however, Grafana issues several "POST" requests which leads to the error in the title:

"response:"{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The msearch request must be terminated by a newline [\n]"}],"type":"illegal_argument_exception","reason":"The msearch request must be terminated by a newline [\n]"},"status":400}"

My code is simple:
r = requests.post(request, auth=awsauth, json=event['body']+"\n")

Is there a way anybody knows to actually append a newline to a POST request from python?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.