ConnectionResetError 104

I am trying to connect to this endpoint and hoping to receive a excel file:
"https://api.refinitiv.com/data/change-notifications/v1/published-notifications/211744/attachments/DN_ContentsetANDProduct_Impact.xlsx/.tWLIDJLHSzhZ1zBnHqOboyu8CqsFKMF"
It works when I try and connect using the API Playground but not locally.
However, I get a ConnectionResetError 104. I am able to get a token using this endpoint:
"https://api.refinitiv.com/auth/oauth2/v1/token". And I am also able to connect other endpoints.
Is there a reason I cannot access this endpoint locally? Does it something to do with it returning an excel file? This is my code:
TOKEN_URL = "https://api.refinitiv.com/auth/oauth2/v1/token"
DATA_URL = "https://api.refinitiv.com/data/change-notifications/v1/published-notifications/211744/attachments/DN_ContentsetANDProduct_Impact.xlsx/.tWLIDJLHSzhZ1zBnHqOboyu8CqsFKMF"
def get_token(user: str, password: str, api_key: str): request_body = { "username": user, "password": password, "grant_type": "password", "scope": "trapi", "takeExclusiveSignOnControl": True, } response = requests.post( TOKEN_URL, headers={}, data=request_body, auth=(api_key, ""), timeout=30.0 ) response.raise_for_status() return json.loads(response.text.encode("ascii", "ignore"))
def get_data(token: str) -> str: headers = { "Authorization": f"Bearer {token}", "Accept": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" } response = requests.request("GET", DATA_URL, headers=headers, data={}) response.raise_for_status() return response.content
cred = get_credentials("lsegapi")
tok = get_token(user=cred.user, password=cred.password, api_key="cfd7d81fca5b40749db0217a59e438f5f49a0926")
data = get_data(tok["access_token"])
data
Answers
-
Hi @Visharlya ,
I found the question related to similar issue in this Stack Overflow post, it might be due to your internet connection. the user there had the same problem and changed their internet connection to another network and the issue was solved for them. Can you give it a try by changing your internet network and let me know if it works.
0 -
Hi, I have tried changing my internet network and I still get the same error?
0 -
Hi, I have tried changing my internet network and I still get the same error?
0 -
It may be the firewall or network issue.
Can you test this code?
import requests res = requests.get("https://api.refinitiv.com/data/change-notifications/v1/published-notifications/211744/attachments/DN_ContentsetANDProduct_Impact.xlsx/.tWLIDJLHSzhZ1zBnHqOboyu8CqsFKMF") print(res.status_code) print(res.text)
0 -
I get this error:
401
{"error":{"id":"203eb776-4863-4497-9ad3-2a870248fac1","code":"401","message":"Authorization header is missing","status":"Unauthorized"}}0 -
I get this error:
401
{"error":{"id":"203eb776-4863-4497-9ad3-2a870248fac1","code":"401","message":"Authorization header is missing","status":"Unauthorized"}}0 -
This means the Python application can connect to that endpoint.
However, I can't test the code because my account doesn't have permission to access the Notifi API.
You can contact the Notifi API support team directly via MyAccount to verify what the problem is.
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 中文论坛