Error 403 when downloading files from API

AlekseiKozlov
Newcomer
We have an error when trying to download files from the filings api: https://api.refinitiv.com/data/filings/v1/retrieval/search/docId/{doc_id}
The goal is to be able to download the original file. Using the above api, we obtain a valid url (see code below).However the url does not work from Databricks, resulting in a 403 forbidden. The same code works as expected from our laptop. Code example:
def get_pdf_content(pdf_url):
headers = {
"Accept": "application/pdf",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
}
response = requests.get(pdf_url, headers=headers)
if response.status_code != 200:
raise Exception(f"Error: {response.status_code} while downloading PDF: {response.text}")
return response.content get_pdf_content("https://cdn-filings.filings.refinitiv.com/retrieval/filings/20231229_4295877697_97681355318_1_26_ESG_raw.pdf?ClientID=API_Playground&Expires=1744813219&Signature=Le-nXXD7OaxbgoBjUKaFzX7FGT69B9TuSt22fxE4QRQCdDvxxLdK~XXdmzy~NMFWcF2WbBiCXLHFJYsQuQQ7OSjW302qjIOkRXSeZgmUB9IlviP~K2z1PGYrsNn5mtdcI9SCojr6JLAT59kKMvvEh2kacII5O3PNUoufKh2z2qCbirKZuyu3EVAD8muM-vS9Dk7iH0Hzji9c7vxftQZiyASk7uEGyN94buUPeqY6z3T4b6~0RMCU0iEmhVIvl9jXlGn-qTQSztCalzK0zj4Lc7kvOLNqRL~CgYuAABg-Vexnwbd2dSlU-QJrZUukoMBkXzcMQqporoqvpUrlqntFcw__&Key-Pair-Id=APKAIDW27KNAZ6YUBN7A")
Error: 403 - Forbidden
Error: 403 while downloading PDF: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The request could not be satisfied</TITLE> </HEAD><BODY> <H1>403 ERROR</H1> <H2>The request could not be satisfied.</H2> <HR noshade size="1px"> Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. <BR clear="all"> If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation. <BR clear="all"> <HR noshade size="1px"> <PRE> Generated by cloudfront (CloudFront) Request ID: tzoAj2QX9YTyHZXTfj4GfAgzckGfKFsP5Xf5rbw3mDI5maS5LaKjtA== </PRE> <ADDRESS> </ADDRESS> </BODY></HTML>
Tagged:
0
Answers
-
Hello @AlekseiKozlov
The error message indicates that the HTTP request to https://cdn-filings.filings.refinitiv.com endpoint is blocked.
Did you run a script behind a Coporate firewall or proxy? If so, the request message might be blocked from your company policy. I strongly suggest you contact your local IT support to check this network issue.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛