CSV Export Redirection Python
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 08:43 PM
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.
Any help and suggestion is much appreciated.
Code:
"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)
Labels:
- Labels:
-
Facilities Service Management
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2018 12:22 AM
Hello LB,
Maye you can check the following link which might help you:
Thanks,
Dravvy
Please Hit Helpful or Correct depending on the impact of the response