There's not really a supported way to communicate with the Postman app from a different process to run requests (see e.g. https://github.com/postmanlabs/postman-app-support/issues/86), it falls out of the scope of the tool.
If I understood well the gist of the question; basically, what you're trying to achieve is to concatenate a couple of network requests, reusing data between them. As I see it, there's a couple of approaches you can take:
Do both requests on your python code:
You don't need the overhead of opening a browser to send a HTTP request; instead, simply use a library - like urllib
or requests
- to do the job. Here's an example:
import req
# First request is a GET to "url"
r1 = requests.get(url)
# POST the contents of r1's reply to a different endpoint:
r2 = requests.post("http://url.tld/endpoint", data=r1.json())
From there you can continue querying r2
in the script to find out details or manipulate the data.
Create 2 different Postman requests and run them in sequence
Similarly, you can create both requests in postman, use the test tab to extract the body of the response, save it as environment variable and then reuse it on next requests.
var body = pm.response.json();
pm.environment.set("body", body);
You can access the env.var. with the handlebars notation - i.e. {{body}}
Note that if there was any extra reason you wanted to do the request from the browser (e.g. cookies) you can manually export one as cURL from the Network tab on the Chrome devtools and import it back to postman or capture the browser's activity using Postman interceptor. This will preserve headers/any additional data to be able to reuse it in the future.