# Error in downloading report file using python SDK

**URL:** <https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822>\
**Category:** SHF Discussion and Questions\
**Tags:** python-sdk, sailpoint-identity-security\
**Created:** [February 12, 2025, 5:53pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822 "2025-02-12T17:53:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![svenkitachalam](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@svenkitachalam](https://developer.sailpoint.com/discuss/u/svenkitachalam)\
**Post date:** [February 12, 2025, 5:53pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/1 "2025-02-12T17:53:50Z")

</div>

Hi Team,

I am using Python SDK to perform certain report operations. As part of that I am trying to download a report using sailpoint.v2024.ReportsDataExtractionApi.getReport(reportid,fileformat). This is returning an exception -  
Reason: {“errorName”:“NotAcceptableException”,“errorMessage”:“RESTEASY003635: No match for accept header”,“trackingId”:“xyz”}  
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Wed, 12 Feb 2025 07:36:20 GMT’, ‘Content-Type’: ‘application/json;charset=utf-8’, ‘Connection’: ‘keep-alive’, ‘Server’: ‘nginx’, ‘Vary’: ‘Origin, Access-Control-Request-Method, Access-Control-Request-Headers’, ‘SLPT-Request-ID’: ‘xxxx’, ‘Access-Control-Expose-Headers’: ‘SLPT-Request-ID, Content-Type’, ‘X-Robots-Tag’: ‘noindex’, ‘Content-Length’: ‘146’})  
HTTP response body: detail\_code=None tracking\_id=‘xxxx’ messages=None causes=None

Anyone faced this issue?

Thanks in advance!

Regards,  
Sreejith

---

<div class="post-metadata">

**Author:** ![mpotti](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/mpotti/32/2916_2.png) [@mpotti](https://developer.sailpoint.com/discuss/u/mpotti)\
**Post date:** [February 12, 2025, 7:26pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/2 "2025-02-12T19:26:36Z")

</div>

Can you share the code leading up to the export of the report? There appears to be an issue with your headers based on this error message.

---

<div class="post-metadata">

**Author:** ![svenkitachalam](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@svenkitachalam](https://developer.sailpoint.com/discuss/u/svenkitachalam)\
**Post date:** [February 12, 2025, 7:33pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/3 "2025-02-12T19:33:36Z")

</div>

I am not setting any headers assuming SDK does the request part. Here’s the code. I am able to execute get\_report\_result successfully. Only the get\_report is failing.

configuration = Configuration()  
with sailpoint.v2024.ApiClient(configuration) as api\_client:  
api\_instance=sailpoint.v2024.ReportsDataExtractionApi(api\_client)  
report\_id = “ad5415c409b5497583dcde0bfa149ce5”  
try:  
api\_reponse = api\_instance.get\_report(report\_id,“csv”,“test.csv”)  
print(api\_reponse)  
except Exception as e:  
print(“Exception when calling get report: %s\n” % e)

---

<div class="post-metadata">

**Author:** ![mpotti](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/mpotti/32/2916_2.png) [@mpotti](https://developer.sailpoint.com/discuss/u/mpotti)\
**Post date:** [February 12, 2025, 8:24pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/4 "2025-02-12T20:24:00Z")

</div>

I would look into the api\_instance variable and make user it is returning what you expect. It could be that the hard coded id might be the root cause. I would expect the ID would be in the api\_instance. Each time a report is ran I would think that the ID would change.

---

<div class="post-metadata">

**Author:** ![svenkitachalam](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@svenkitachalam](https://developer.sailpoint.com/discuss/u/svenkitachalam)\
**Post date:** [February 12, 2025, 10:24pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/5 "2025-02-12T22:24:54Z")

</div>

The hard coded id is the report id. I am able to fetch the report details and download the report with that id via postman. The same id fetches report details via python sdk, so I am guessing the api\_instance is accurate.  
Seems like a bug in python SDK to me, specifically on the get\_report function.

---

<div class="post-metadata">

**Author:** ![svenkitachalam](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@svenkitachalam](https://developer.sailpoint.com/discuss/u/svenkitachalam)\
**Post date:** [February 12, 2025, 10:38pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/6 "2025-02-12T22:38:18Z")

</div>

Code provided in the git doesn’t work either. Gives the same 500 error which makes me think even more that this function is buggy.

> <https://github.com/sailpoint-oss/python-sdk/blob/52ba6027e4143ca195feffe7ff68e5f57ae0d473/sailpoint/v2024/docs/ReportsDataExtractionApi.md>

---

<div class="post-metadata">

**Author:** ![svenkitachalam](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@svenkitachalam](https://developer.sailpoint.com/discuss/u/svenkitachalam)\
**Post date:** [February 12, 2025, 10:51pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/7 "2025-02-12T22:51:51Z")

</div>

Was able to get this to work by explicitly specifying the header accept. Postman didn’t need it and this was not marked as required in the python SDK either. Thank you @mpotti for your suggestions.

# Create an instance of the API class

```
api_instance = sailpoint.v2024.ReportsDataExtractionApi(api_client)
task_result_id = 'ad5415c409b5497583dcde0bfa149ce5' # str | Unique identifier of the task result which handled report
file_format = 'csv' # str | Output format of the requested report file
name = 'Identities Details Report' # str | preferred Report file name, by default will be used report name from task result. (optional)
auditable = False # bool | Enables auditing for current report download. Will create an audit event and sent it to the REPORT cloud-audit kafka topic. Event will be created if there is any result present by requested taskResultId. (optional) (default to False)
headers = {
    #'Content-Type': 'application/json',
    #'Authorization': 'Bearer your_token',
    'Accept': 'application/csv'
}
try:
    # Get Report File
    api_response = api_instance.get_report(task_result_id, file_format, name=name, auditable=auditable,_request_timeout=None,_headers=headers)
    print("The response of ReportsDataExtractionApi->get_report:\n")
    print(api_response)

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [April 13, 2025, 10:52pm UTC](https://developer.sailpoint.com/discuss/t/error-in-downloading-report-file-using-python-sdk/100822/8 "2025-04-13T22:52:42Z")

</div>

Closed on April 13, 2025, 10:52pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
