Can't get API to work in local script (works in codebook)

Trying to fetch some historical data from Eikon API. I am running the following code:

# Importing libraries
import eikon as ek
import datetime
import pandas as pd
ek.set_app_key('MY APP KEY')
# Defining start time for the data series
start = datetime.datetime.now() - datetime.timedelta(days=1)  # 1 day ago
end = datetime.datetime.now()
# Defining lists with RIC's under interest
rics = ['US10YT=RR']
# Fetching intraday time series data with 1-minute intervals 
data = ek.get_timeseries(rics, start_date=start, end_date=end, interval='minute', fields="CLOSE")
print(data)

This works in the codebook editor in the application, where I get the wanted output. However, when I try to run this script on my local device I get the following error:

2023-12-13 15:56:01,612 P[33280] [MainThread 26372] HTTP request failed: EikonError-Client Error: <!-- IE friendly error message walkround.

if error message from server is less than

512 bytes IE v5+ will use its own error

message instead of the one returned by

server. -->

... Together with a lot of HTML code. It seems like it somehow connects, since I don't get an error, but I don't get the data either. Is there a solution for this?

Best Answer

Answers