Error code 404 in Python

Today I can not retrieve EOD price of yesterday.
I use python and get error like this

Python worked for a years, but the last 2 days have not work
.
Error code 404 | Client Error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /api/v1/data</pre>
</body>
</html>

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\py\daily_price_insert.py", line 61, in <module>
df, e = ek.get_data(screener_exp,fields=field2, parameters=parameter)
File "C:\Python\Python37\lib\site-packages\eikon\data_grid.py", line 186, in get_data
result = eikon.json_requests.send_json_request(_endpoint, payload, debug=debug)
File "C:\Python\Python37\lib\site-packages\eikon\json_requests.py", line 121, in send_json_request
_raise_for_status(response)
File "C:\Python\Python37\lib\site-packages\eikon\json_requests.py", line 244, in _raise_for_status
raise EikonError(response.status_code, error_msg)
eikon.eikonError.EikonError: Error code 404 | Client Error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /api/v1/data</pre>
</body>
</html>

Tagged:

Best Answer

  • pf
    pf
    Answer ✓

    Hi @tanin,

    The first step with any error is to activate debug traces and check log files.

    As this log file contains personal info related to your user account (app_key, user login, ...), it's recommended to verify what you'll post.

    About your case, we need more information, at least the log file. You can send it to customer support, they'll forward us.

    Did you check basic steps from Eikon Data API(Python) Troubleshooting | Refinitiv ?
    Especially, did you check that the session was opened successfully ? (some permission may have been changed)




Answers

  • Hi @FrancesGale.Sulam ,

    For internal support on Python libs, please send an email to dataapispythonsupport@lseg.com


  • Hi Team, This is not for me. I submitted this for an external client
  • I use this code for a years but last 2 days it shows error
    .
    Error code 404 | Client Error: <!DOCTYPE html>
    .
    how to solve this?

  • This is an urgent issue, so please help
  • Moreover because this is not a technical issue within the API but something specific to the client and it'll need to share user info that shouldn't be published on this site.

  • hi @tanin and @FrancesGale.Sulam ,

    Could you please try restarting your machine and relogging into Eikon and check if the issue still persists?

    If so, please try step no. 7 in this article, Eikon Data API(Python) Troubleshooting | Refinitiv and check if you have API endpoint enabled or not. Then please let us know the result for further investigation.

  • Hi pf

    I'm in Thailand and every morning I use python and can retrieve data everyday, but last 2 days it can not retrieve in morning (8am) but can retrieve in the afternoon (2pm), so I think no problem in python code

  • hi @tanin ,

    Sorry to hear that the issue occurs. However, for further investigation, could you please provide the log of when the error occurred and when the code ran successfully, and the code snippet used?

    Then the log and code are going to be checked what's going on during that specific run (when the error occurred and when it ran successfully) and used to reproduce the issue.



  • import eikon as ek
    import pandas as pd
    #!/usr/bin/python
    from pandas.io import sqlek.set_app_key('xxxxxxxxx')
    screener_exp ='SCREEN(U(IN(Equity(active,public,primary))), IN(TR.ExchangeCountryCode,TH))'
    field1= ['TR.CommonName','TR.TickerSymbol','TR.ExchangeMarketIdCode','TR.PriceCloseDate',
    'TR.PriceOpen','TR.PriceHigh','TR.PriceLow','TR.CLOSEPRICE']field2 = ['TR.TickerSymbol','TR.PriceCloseDate','TR.PriceOpen','TR.PriceHigh','TR.PriceLow','TR.CLOSEPRICE','TR.Volume','TR.TSVWAP']
    parameter={'SDate':0, 'EDate':0, 'Frq' : 'D' }df = pd.DataFrame()
    df, e = ek.get_data(screener_exp,fields=field2, parameters=parameter)
    .
    and got error Error code 404 | Client Error: <!DOCTYPE html>


  • but today it's work !!! so I think python code is not problem but maybe data pipeline has something wrong
  • today it's work, no problem like last 2 days.
  • hi @tanin ,

    I also can not reproduce the error. Could you please get the log based on the article mentioned above and provide it for investigation if the issue persists again next time?

    I'm really sorry for this inconvinient.

  • Yes, the problem occurred for a short 2-days period, at that time if we reproduced it, we will always see it. But now the issue is gone by itself. With the same code, we either couldn't reproduce it. We think there could be something in Refinitiv's data server/feed triggered it.

    Next time, if we face this same issue again, we will enable the log and get the log to you.