Service Now CSV Export Redirection Python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mavecnirp
    New Member
    • Jul 2018
    • 1

    Service Now CSV Export Redirection Python

    I am currently working on a project and I have been stuck in exporting a table from the servicenow website using the code below, it is returning a URL redirection instead of the CSV.


    Code:
    url = "https://url.service-now.com/nav_to.do?" \
                        "uri=server_list.do?sysparm_query=active=false%26CSV"
     
     
    response = requests.get(url, stream=True, headers=headers, allow_redirects=True, verify="C:\\Users\\user\\PycharmProjects\\cert.crt")
     
    LocalFilePath = "C:\\Users\\user\\Documents\\Projects\\Reporting\\server.csv"
     
     
    with open(LocalFilePath, 'wb') as csv2:
        csv2.write(response.content)

    Any help and suggestion is much appreciated.
Working...