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)