Error code 408 \ HTTP TimeoutException
Recently, sometimes when I use eikon.get_data(), it will occur 408 error, and the error kept coming up for the next 30 mins. Then suddenly it can works well again to get the data I want. I want to know why and how can this problem be sovled.
The error show below:
2023-12-13 11:11:03,926 P[9384] [MainThread 8516] HTTP TimeoutException: .
Traceback (most recent call last):
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\anyio\_core\_tasks.py", line 115, in fail_after
yield cancel_scope
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\backends\asyncio.py", line 34, in read
return await self._stream.receive(max_bytes=max_bytes)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\anyio\_backends\_asyncio.py", line 1103, in receive
await self._protocol.read_event.wait()
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\asyncio\locks.py", line 214, in wait
await fut
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\asyncio\futures.py", line 285, in __await__
yield self # This tells Task to wait for completion.
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 304, in __wakeup
future.result()
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\asyncio\futures.py", line 196, in result
raise exc
asyncio.exceptions.CancelledError: Cancelled by cancel scope 2216762ac50
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_exceptions.py", line 10, in map_exceptions
yield
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\backends\asyncio.py", line 32, in read
with anyio.fail_after(timeout):
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\anyio\_core\_tasks.py", line 118, in fail_after
raise TimeoutError
TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions
yield
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_async\connection_pool.py", line 261, in handle_async_request
raise exc
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_async\connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_async\connection.py", line 96, in handle_async_request
return await self._connection.handle_async_request(request)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_async\http11.py", line 120, in handle_async_request
raise exc
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_async\http11.py", line 99, in handle_async_request
) = await self._receive_response_headers(**kwargs)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_async\http11.py", line 163, in _receive_response_headers
event = await self._receive_event(timeout=timeout)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_async\http11.py", line 199, in _receive_event
data = await self._network_stream.read(
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\backends\asyncio.py", line 31, in read
with map_exceptions(exc_map):
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ReadTimeout
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\eikon\json_requests.py", line 114, in send_json_request
response = profile.send_request(json=ticket_request, timeout=(15.0, 15.0))
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\eikon\Profile.py", line 348, in send_request
response = self._desktop_session.http_request(url=self.get_url(),
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\eikon\streaming_session\session.py", line 670, in http_request
response = loop.run_until_complete(self.http_request_async(url, method, headers, data,
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\nest_asyncio.py", line 99, in run_until_complete
return f.result()
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\asyncio\futures.py", line 201, in result
raise self._exception.with_traceback(self._exception_tb)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 232, in __step
result = coro.send(None)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\eikon\streaming_session\session.py", line 658, in http_request_async
raise t
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\eikon\streaming_session\session.py", line 637, in http_request_async
_request_response = await self._http_session.request(
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_client.py", line 1617, in send
response = await self._send_handling_auth(
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_transports\default.py", line 352, in handle_async_request
with map_httpcore_exceptions():
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadTimeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\idlelib\run.py", line 578, in runcode
exec(code, self.locals)
File "D:\eikon\SCS.py", line 87, in <module>
data_root_1, err = ek.get_data("0#SGXIOS62:", fields_root ,field_name = True) # Iron Ore 62% Fe, CFR China(USD/MT)',
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\eikon\data_grid.py", line 190, in get_data
result = eikon.json_requests.send_json_request(_endpoint, payload, debug=debug)
File "C:\Users\JE Group Treasury\AppData\Local\Programs\Python\Python310\lib\site-packages\eikon\json_requests.py", line 131, in send_json_request
raise EikonError(408, error_msg)
eikon.eikonError.EikonError: Error code 408 | HTTP TimeoutException: .
Best Answer
-
It is an HTTP request timeout. As much as I know timeout in the API is around 15 seconds. If Eikon doesn't respond to the ticket request within this timeout, it will throw this error.
EikonError: Error code 408 | HTTP TimeoutException: .
you can try to change the timeout value by calling the following method.
ek.set_timeout(50)
If it doesn't help, you may try to reduce the number of requested items or reduce the time range when requesting data.
I hope this will help.
Best regards,
Haykaz
0
Answers
-
Hi, I already set the timeout value to 100 before, and sometimes I just ask for one RIC for CF_ASK data which has very just one row data, and still this error occurred. Could there be other reasons for this? Cause I set up automatic data extraction at 12 pm everyday. And this error often occurs which is very troublesome. Thank you0
-
Hi @kathy.ky.ching ,
Another thing I can suggest is wrapping the API request in try except statement and retrying a couple of times. This may help avoid temporary sever overloads.
max_retries = 3
retries = 0
while retries<max_retries:
try:
data_root_1, err = ek.get_data("0#SGXIOS62:", ['CF_NAME'], field_name = True)
break
except Exception as e:
print(retries, e)
retries +=1
#time.sleep(5)
continue
data_root_1Best regards,
Haykaz
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛