This works great. Thanks a lot, cwue. Those who don't have access to "requests" library can use curl command like the following:
import subprocess
file_out = "/home/splunk/pdf_dashboards/yourpdfile.pdf"
subprocess.call(["curl","-G", "-sku", "your_user_name:your_password","-k", Url, "--data-urlencode", "input-dashboard-xml=" + XMLDashboard,"-d","namespace=yourAppName", "-d","paper-size=a4-landscape"], stdout=file_out)
if you are using "--data-urlencode" then you don't have to use the following two lines:
XMLDashboard=XMLfile.read().replace('\n', '')
XMLDashboard = XMLDashboard.replace('<', '%26lt%3B') # otherwise the API will complain
Good Luck and Thanks to cwue once again.
... View more