I need to download thread dumps through an external system, and I know that the following script works to do so:
import requests
url = "http://localhost/data/status/diagnostics/threads/threaddump"
contentType = "application/json"
jsessionid="JSESSIONID=node01la3zauakwhljdd4x63ivwrps1.node0"
headers = {
'Content-Type': contentType,
'Cookie': jsessionid
}
# The response will be a file, save that file
response = requests.request("GET", url, headers=headers, stream=True)
with open('threaddump.json', 'wb') as f:
for chunk in response.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
The problem is that the JSESSIONID needs to be provided or the endpoint is forbidden. I have been struggling to get a JSESSIONID first with the built in IDP, any ideas on how to do that?