I have written a python script that will make a call to a server and fetch the response. While making a call to the server, it will pass few values in the body of the request. This value is supposed to be fetched by reading a text file. The text file sample is given below.
My text file sample:
Host: localhost:8080
Connection: keep-alive
.....
.....
{"token":"abcdefhutryskslkslksslslks=="}POST /fill/entry/login HTTP/1.1
Host: localhost:8080
Connection: keep-alive
.....
.....
{"value":"abcdefghijklmnopqrstuvwxyz",
"pass":"123456789zxcvbnmljhgfds",
"token":"abcdefghijklmnopqrstuvwxyz=="}POST /fill/health HTTP/1.1
Here, if you can observe, I get different responses. I need to capture the string that starts with {"value" and ends with "} (the second part of the response as seen in the sample).
On searching in stack overflow, I came across scenarios where they extract the string but however they have a definite start point and a definite end point. In my case, even though the start point can be identified uniquely using the search string " {"url ", the end point cannot be identified as the text file contains multiple other parentheses as well.
Any suggestions/pointers on fetching the specific part of the sting from the text file(as stated above) will be really helpful.