Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
1 0 0 0

Error Retrieving Data through Eikon API

Hi Team,

I managed to install the eikon package and set the app key, however, when I tried to run any of the test codes, like

"

df = ek.get_timeseries(["MSFT.O"],

start_date="2016-01-01",

end_date="2016-01-10")

"

I ran into error. It would be great it someone could provide some advice. Thanks in advance!!


Here's what I see:

2024-05-08 22:17:29,539 P[5380] [MainThread 16824] Error code 407 | Client Error: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<!-- FileName: index.html

Language: [en]

-->

<!--Head-->

<head>

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<meta http-equiv="X-UA-Compatible" content="IE=7" />

<title>McAfee Web Gateway - Notification</title>

<script src="/mwg-internal/de5fs23hu73ds/files/javascript/sw.js" type="text/javascript" ></script>

<link rel="stylesheet" href="/mwg-internal/de5fs23hu73ds/files/default/stylesheet.css" />

</head>

<!--/Head-->

<!--Body-->

<body onload="swOnLoad();">

<table class='bodyTable'>

<tr>

<td class='bodyData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_body.gif'>

<!--Logo-->

<table class='logoTable'>

<tr>

<td class='logoData'>

<a href='http://www.mcafee.com'>

<img src='/mwg-internal/de5fs23hu73ds/files/default/img/logo_mwg.png'></a>

</td>

</tr>

</table>

<!--/Logo-->

<!--Contents-->

<h1>Authentication Required</h1>

<!--Content-->

<table class="contentTable">

<tr>

<td class="contentData">

You must be authenticated to access this URL.

</td>

</tr>

</table>

<script language="javascript" type="text/javascript">

urlprotocol = "http";

statuscode=407;


if(statuscode==401 && urlprotocol == "ftp"){

document.write("<form name=\"ftpform\" method=\"get\" action=\"\">");

document.write("<table class=\"contentData\">");

document.write("<tr><td class=\"contentData\" colspan=2>Please enter your credentials in the form below and click \"Access FTP\" button if your browser doesn't present authentication prompt for FTP sites.</td></tr>");

document.write("<tr><td class=\"contentData\">Username:</td><td><input type=\"text\" id=\"ftpUsername\" name=\"ftpUsername\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\">Password:</td><td><input type=\"password\" id=\"ftpPassword\" name=\"ftpPassword\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\" colspan=2 align=center><input type=\"button\" onclick=\"redirectToFTP();\" value=\"Access FTP\" /></td></tr>");

document.write("</table>");

document.write("</form>");

}

function redirectToFTP(){

var username=unescape(document.getElementById("ftpUsername").value);

var password=unescape(document.getElementById("ftpPassword").value);

location.href = "ftp://"+username+":"+password+"@127.0.0.1:9060/api/v1/data"

}

</script>

<!--/Content-->


<!--Info-->

<table class="infoTable">

<tr>

<td class="infoData">

<b>URL: </b><script type="text/javascript">break_line("http://127.0.0.1:9060/api/v1/data");</script><br />

</td>

</tr>

</table>

<!--/Info-->


<!--/Contents-->

<!--Policy-->

<table class='policyTable'>

<tr>

<td class='policyHeading'>

<hr>

Company Acceptable Use Policy

</td>

</tr>

<tr>

<td class='policyData'>

This is an optional acceptable use disclaimer that appears on every page. You may change the wording or remove this section entirely in index.html.

</td>

</tr>

</table>

<!--/Policy-->

<!--Foot-->

<table class='footTable'>

<tr>

<td class='helpDeskData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_navbar.jpg'>

For assistance, please contact your system administrator.

</td>

</tr>

<tr>

<td class='footData'>

generated <span id="time">2024-05-08 14:17:29</span> by McAfee Web Gateway

<br />

python-httpx/0.27.0

</td>

</tr>

</table>

<!--/Foot-->

</td>

</tr>

</table>

</body>

<!--/Body-->

</html>


2024-05-08 22:17:29,550 P[5380] [MainThread 16824] HTTP request failed: EikonError-Client Error: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<!-- FileName: index.html

Language: [en]

-->

<!--Head-->

<head>

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<meta http-equiv="X-UA-Compatible" content="IE=7" />

<title>McAfee Web Gateway - Notification</title>

<script src="/mwg-internal/de5fs23hu73ds/files/javascript/sw.js" type="text/javascript" ></script>

<link rel="stylesheet" href="/mwg-internal/de5fs23hu73ds/files/default/stylesheet.css" />

</head>

<!--/Head-->

<!--Body-->

<body onload="swOnLoad();">

<table class='bodyTable'>

<tr>

<td class='bodyData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_body.gif'>

<!--Logo-->

<table class='logoTable'>

<tr>

<td class='logoData'>

<a href='http://www.mcafee.com'>

<img src='/mwg-internal/de5fs23hu73ds/files/default/img/logo_mwg.png'></a>

</td>

</tr>

</table>

<!--/Logo-->

<!--Contents-->

<h1>Authentication Required</h1>

<!--Content-->

<table class="contentTable">

<tr>

<td class="contentData">

You must be authenticated to access this URL.

</td>

</tr>

</table>

<script language="javascript" type="text/javascript">

urlprotocol = "http";

statuscode=407;


if(statuscode==401 && urlprotocol == "ftp"){

document.write("<form name=\"ftpform\" method=\"get\" action=\"\">");

document.write("<table class=\"contentData\">");

document.write("<tr><td class=\"contentData\" colspan=2>Please enter your credentials in the form below and click \"Access FTP\" button if your browser doesn't present authentication prompt for FTP sites.</td></tr>");

document.write("<tr><td class=\"contentData\">Username:</td><td><input type=\"text\" id=\"ftpUsername\" name=\"ftpUsername\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\">Password:</td><td><input type=\"password\" id=\"ftpPassword\" name=\"ftpPassword\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\" colspan=2 align=center><input type=\"button\" onclick=\"redirectToFTP();\" value=\"Access FTP\" /></td></tr>");

document.write("</table>");

document.write("</form>");

}

function redirectToFTP(){

var username=unescape(document.getElementById("ftpUsername").value);

var password=unescape(document.getElementById("ftpPassword").value);

location.href = "ftp://"+username+":"+password+"@127.0.0.1:9060/api/v1/data"

}

</script>

<!--/Content-->


<!--Info-->

<table class="infoTable">

<tr>

<td class="infoData">

<b>URL: </b><script type="text/javascript">break_line("http://127.0.0.1:9060/api/v1/data");</script><br />

</td>

</tr>

</table>

<!--/Info-->


<!--/Contents-->

<!--Policy-->

<table class='policyTable'>

<tr>

<td class='policyHeading'>

<hr>

Company Acceptable Use Policy

</td>

</tr>

<tr>

<td class='policyData'>

This is an optional acceptable use disclaimer that appears on every page. You may change the wording or remove this section entirely in index.html.

</td>

</tr>

</table>

<!--/Policy-->

<!--Foot-->

<table class='footTable'>

<tr>

<td class='helpDeskData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_navbar.jpg'>

For assistance, please contact your system administrator.

</td>

</tr>

<tr>

<td class='footData'>

generated <span id="time">2024-05-08 14:17:29</span> by McAfee Web Gateway

<br />

python-httpx/0.27.0

</td>

</tr>

</table>

<!--/Foot-->

</td>

</tr>

</table>

</body>

<!--/Body-->

</html>



Traceback (most recent call last):


File C:\ProgramData\anaconda3\lib\site-packages\eikon\json_requests.py:127 in send_json_request

_raise_for_status(response)


File C:\ProgramData\anaconda3\lib\site-packages\eikon\json_requests.py:271 in _raise_for_status

raise EikonError(response.status_code, error_msg)


EikonError: Error code 407 | Client Error: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<!-- FileName: index.html

Language: [en]

-->

<!--Head-->

<head>

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<meta http-equiv="X-UA-Compatible" content="IE=7" />

<title>McAfee Web Gateway - Notification</title>

<script src="/mwg-internal/de5fs23hu73ds/files/javascript/sw.js" type="text/javascript" ></script>

<link rel="stylesheet" href="/mwg-internal/de5fs23hu73ds/files/default/stylesheet.css" />

</head>

<!--/Head-->

<!--Body-->

<body onload="swOnLoad();">

<table class='bodyTable'>

<tr>

<td class='bodyData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_body.gif'>

<!--Logo-->

<table class='logoTable'>

<tr>

<td class='logoData'>

<a href='http://www.mcafee.com'>

<img src='/mwg-internal/de5fs23hu73ds/files/default/img/logo_mwg.png'></a>

</td>

</tr>

</table>

<!--/Logo-->

<!--Contents-->

<h1>Authentication Required</h1>

<!--Content-->

<table class="contentTable">

<tr>

<td class="contentData">

You must be authenticated to access this URL.

</td>

</tr>

</table>

<script language="javascript" type="text/javascript">

urlprotocol = "http";

statuscode=407;


if(statuscode==401 && urlprotocol == "ftp"){

document.write("<form name=\"ftpform\" method=\"get\" action=\"\">");

document.write("<table class=\"contentData\">");

document.write("<tr><td class=\"contentData\" colspan=2>Please enter your credentials in the form below and click \"Access FTP\" button if your browser doesn't present authentication prompt for FTP sites.</td></tr>");

document.write("<tr><td class=\"contentData\">Username:</td><td><input type=\"text\" id=\"ftpUsername\" name=\"ftpUsername\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\">Password:</td><td><input type=\"password\" id=\"ftpPassword\" name=\"ftpPassword\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\" colspan=2 align=center><input type=\"button\" onclick=\"redirectToFTP();\" value=\"Access FTP\" /></td></tr>");

document.write("</table>");

document.write("</form>");

}

function redirectToFTP(){

var username=unescape(document.getElementById("ftpUsername").value);

var password=unescape(document.getElementById("ftpPassword").value);

location.href = "ftp://"+username+":"+password+"@127.0.0.1:9060/api/v1/data"

}

</script>

<!--/Content-->


<!--Info-->

<table class="infoTable">

<tr>

<td class="infoData">

<b>URL: </b><script type="text/javascript">break_line("http://127.0.0.1:9060/api/v1/data");</script><br />

</td>

</tr>

</table>

<!--/Info-->


<!--/Contents-->

<!--Policy-->

<table class='policyTable'>

<tr>

<td class='policyHeading'>

<hr>

Company Acceptable Use Policy

</td>

</tr>

<tr>

<td class='policyData'>

This is an optional acceptable use disclaimer that appears on every page. You may change the wording or remove this section entirely in index.html.

</td>

</tr>

</table>

<!--/Policy-->

<!--Foot-->

<table class='footTable'>

<tr>

<td class='helpDeskData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_navbar.jpg'>

For assistance, please contact your system administrator.

</td>

</tr>

<tr>

<td class='footData'>

generated <span id="time">2024-05-08 14:17:29</span> by McAfee Web Gateway

<br />

python-httpx/0.27.0

</td>

</tr>

</table>

<!--/Foot-->

</td>

</tr>

</table>

</body>

<!--/Body-->

</html>




During handling of the above exception, another exception occurred:


Traceback (most recent call last):


File C:\ProgramData\anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec

exec(code, globals, locals)


File c:\users\w257147\onedrive - cargill inc\documents\frequent\new scripts\untitled0.py:11

df = ek.get_timeseries(["MSFT.O"],


File C:\ProgramData\anaconda3\lib\site-packages\eikon\time_series.py:182 in get_timeseries

ts_result = eikon.json_requests.send_json_request(TimeSeries_UDF_endpoint, payload, debug=debug)


File C:\ProgramData\anaconda3\lib\site-packages\eikon\json_requests.py:134 in send_json_request

raise EikonError(eikon_err.code, eikon_err.message)


EikonError: Error code 407 | Client Error: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<!-- FileName: index.html

Language: [en]

-->

<!--Head-->

<head>

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<meta http-equiv="X-UA-Compatible" content="IE=7" />

<title>McAfee Web Gateway - Notification</title>

<script src="/mwg-internal/de5fs23hu73ds/files/javascript/sw.js" type="text/javascript" ></script>

<link rel="stylesheet" href="/mwg-internal/de5fs23hu73ds/files/default/stylesheet.css" />

</head>

<!--/Head-->

<!--Body-->

<body onload="swOnLoad();">

<table class='bodyTable'>

<tr>

<td class='bodyData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_body.gif'>

<!--Logo-->

<table class='logoTable'>

<tr>

<td class='logoData'>

<a href='http://www.mcafee.com'>

<img src='/mwg-internal/de5fs23hu73ds/files/default/img/logo_mwg.png'></a>

</td>

</tr>

</table>

<!--/Logo-->

<!--Contents-->

<h1>Authentication Required</h1>

<!--Content-->

<table class="contentTable">

<tr>

<td class="contentData">

You must be authenticated to access this URL.

</td>

</tr>

</table>

<script language="javascript" type="text/javascript">

urlprotocol = "http";

statuscode=407;


if(statuscode==401 && urlprotocol == "ftp"){

document.write("<form name=\"ftpform\" method=\"get\" action=\"\">");

document.write("<table class=\"contentData\">");

document.write("<tr><td class=\"contentData\" colspan=2>Please enter your credentials in the form below and click \"Access FTP\" button if your browser doesn't present authentication prompt for FTP sites.</td></tr>");

document.write("<tr><td class=\"contentData\">Username:</td><td><input type=\"text\" id=\"ftpUsername\" name=\"ftpUsername\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\">Password:</td><td><input type=\"password\" id=\"ftpPassword\" name=\"ftpPassword\" size=40 /></td></tr>");

document.write("<tr><td class=\"contentData\" colspan=2 align=center><input type=\"button\" onclick=\"redirectToFTP();\" value=\"Access FTP\" /></td></tr>");

document.write("</table>");

document.write("</form>");

}

function redirectToFTP(){

var username=unescape(document.getElementById("ftpUsername").value);

var password=unescape(document.getElementById("ftpPassword").value);

location.href = "ftp://"+username+":"+password+"@127.0.0.1:9060/api/v1/data"

}

</script>

<!--/Content-->


<!--Info-->

<table class="infoTable">

<tr>

<td class="infoData">

<b>URL: </b><script type="text/javascript">break_line("http://127.0.0.1:9060/api/v1/data");</script><br />

</td>

</tr>

</table>

<!--/Info-->


<!--/Contents-->

<!--Policy-->

<table class='policyTable'>

<tr>

<td class='policyHeading'>

<hr>

Company Acceptable Use Policy

</td>

</tr>

<tr>

<td class='policyData'>

This is an optional acceptable use disclaimer that appears on every page. You may change the wording or remove this section entirely in index.html.

</td>

</tr>

</table>

<!--/Policy-->

<!--Foot-->

<table class='footTable'>

<tr>

<td class='helpDeskData' background='/mwg-internal/de5fs23hu73ds/files/default/img/bg_navbar.jpg'>

For assistance, please contact your system administrator.

</td>

</tr>

<tr>

<td class='footData'>

generated <span id="time">2024-05-08 14:17:29</span> by McAfee Web Gateway

<br />

python-httpx/0.27.0

</td>

</tr>

</table>

<!--/Foot-->

</td>

</tr>

</table>

</body>

<!--/Body-->

</html>

eikon-data-apipythonworkspace#technologypython apierrorrefinitiv-data-platform-eikon
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvote
25.1k 57 17 14

Hello @Wei_Wu

Please be informed that the Eikon Data API needs to connect to the Workspace/Eikon desktop application in the same machine (localhost) because the desktop application acts as a proxy between the API and Workspace platform.

The error messages indicate that the issue relates to the McAfee Web Gateway in your machine. The McAfee software in your machine might intercept this request and reject it. You may need to contact your local IT support team to verify this issue.

However, some users can solve this issue by setting the NO_PROXY environment variable.

import os
os.environ['NO_PROXY'] = '127.0.0.1'

If the setting above does not solve the issue, I highly recommend you contact your local IT support team.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.