403 Client Error: Forbidden for url - download from CFS API

TWD_MMD_Fil3s
TWD_MMD_Fil3s Newcomer
edited May 13 in Eikon Data APIs

I am trying to download the file after getting the authentication token: TM3_TradewebMMDFeed2025-05-09T16:30:00.000-04:00

File Id: 4720-1daf-f4c4fe12-996b-65ea2aa13283

I am getting the below error:

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.refinitiv.com/file-store/v1/files/4720-1daf-f4c4fe12-996b-65ea2aa13283/stream

This is the code snippet:

endpoint = f"{RDP_HOST}/file-store/v1/files/{file_id}/stream"
headers = {
"Authorization": f"Bearer {token}",
"cache-control": "no-cache",
"Accept": "/",
}


with requests.get(endpoint, headers=headers, stream=True, allow_redirects=True, timeout=600) as resp:
resp.raise_for_status()
file_name.parent.mkdir(parents=True, exist_ok=True)
with open(file_name, "wb") as fh:
shutil.copyfileobj(resp.raw, fh, length=16_384)

Answers

  • Hello @TWD_MMD_Fil3s ,

    Seems like you don't have access to the CFS API. Are you able to execute these functions in the API playground?

    API Playground

  • Hi Gurpreet, you are right. i am able to download the file after the provider granted me access to the CFS API.

    Thank you for your help