468,291 Members | 1,614 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,291 developers. It's quick & easy.

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.


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
0 1247

Post your reply

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

Similar topics

3 posts views Thread by Equis Uno | last post: by
1 post views Thread by Josť Joye | last post: by
53 posts views Thread by Michael Tobis | last post: by
3 posts views Thread by jefishman | last post: by
6 posts views Thread by bsma1 | last post: by
10 posts views Thread by Michel Leunen | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.