By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,863 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Service Now CSV Export Redirection Python

P: 1
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.


Expand|Select|Wrap|Line Numbers
  1.  
  2. url = "https://url.service-now.com/nav_to.do?" \
  3.                     "uri=server_list.do?sysparm_query=active=false%26CSV"
  4.  
  5.  
  6. response = requests.get(url, stream=True, headers=headers, allow_redirects=True, verify="C:\\Users\\user\\PycharmProjects\\cert.crt")
  7.  
  8. LocalFilePath = "C:\\Users\\user\\Documents\\Projects\\Reporting\\server.csv"
  9.  
  10.  
  11. with open(LocalFilePath, 'wb') as csv2:
  12.     csv2.write(response.content)
  13.  
  14.  

Any help and suggestion is much appreciated.
Jul 24 '18 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.