# Grafana, python, and POST newline characters

**URL:** <https://discuss.elastic.co/t/grafana-python-and-post-newline-characters/188387>\
**Category:** Elasticsearch\
**Created:** [July 1, 2019, 6:33pm UTC](https://discuss.elastic.co/t/grafana-python-and-post-newline-characters/188387 "2019-07-01T18:33:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpavel](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@jpavel](https://discuss.elastic.co/u/jpavel)\
**Post date:** [July 1, 2019, 6:33pm UTC](https://discuss.elastic.co/t/grafana-python-and-post-newline-characters/188387/1 "2019-07-01T18:33:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 29, 2019, 6:33pm UTC](https://discuss.elastic.co/t/grafana-python-and-post-newline-characters/188387/2 "2019-07-29T18:33:44Z")

</div>

Closed on July 29, 2019, 6:33pm UTC

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