Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

Any help and suggestion is much appreciated.

What I have tried:

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)
Posted
Comments
Richard MacCutchan 24-Jul-18 5:12am    
Use your browser to check what is returned from the URI.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900