I am trying to export the contact list data for a specific Contact list ID, but I am trying to figure out why the data from the URI I am reading is HTML?
The below python script seems to work fine.
When I manually click on the api_response.uri link it does download the required data in .CSV file
When i try to read the csv file from the URI within the python script, it returns a HTML file.
Below is the script I am using.
Any thoughts on how I can load this file in python?
import os
from PureCloudPlatformClientV2.rest import ApiException
from pprint import pprint
import datetime
import logging
import requests
import json
import certifi
import os
from datetime import date
import time
import csv
import inspect
import pandas as pd
region = PureCloudPlatformClientV2.PureCloudRegionHosts.eu_west_1
PureCloudPlatformClientV2.configuration.host = region.get_api_host()
When you invoke get_outbound_contactlist_export(), you receive the download uri. At the end of this URI is the download ID. You can then use this download ID in a call to GET /api/v2/downloads/{downloadId}. (You will see an example of this operation using the python sdk in this link.). This will return the download URI that will download the csv data to your machine on a basic GET request.
try:
# Issues a redirect to a signed secure download URL for specified download
api_response_download = api_instance_download.get_download(download_id)
pprint(api_response_download)
pprint(api_response_download.url)
except ApiException as e:
print("Exception when calling DownloadsApi->get_download: %s\n" % e)
When i print the api_response_download.url from above script it retrurns "None"
I am wondering why that might be as the download_id I am passing in seems to be correct.