Python Forum
Service Now CSV Export Redirection Python
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Service Now CSV Export Redirection Python
#1
I am new in python and currently working on a project and I have been stuck in exporting a table from the servicenow website using the code below, but is returning a URL redirection instead of the CSV.

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.
Reply
#2
Are you sure that url is right? Normally, there's only one question mark, used as a separator between the url and it's parameters. Multiple values chained together also looks weird, normally there's an ampersand separating the arguments.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to access a web service from a python script? dangermaus33 6 3,115 Dec-04-2020, 07:04 AM
Last Post: dangermaus33
  Creating a RESTful web service and web service client dangermaus33 0 1,257 Dec-01-2020, 09:56 PM
Last Post: dangermaus33
  python 3.x and selenium. Service unexpectedly exited volkoshkursk 0 3,623 Aug-12-2017, 12:17 PM
Last Post: volkoshkursk

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020