Hi Team,
using the code:
from __future__ import annotations
import os
from datetime import timedelta
from dotenv import load_dotenv
import lseg.data as ld
def main() -> int:
load_dotenv()
required_env = ["LSEG_APP_KEY", "LSEG_USERNAME", "LSEG_PASSWORD"]
missing = [name for name in required_env if not os.getenv(name)]
if missing:
print(f"Missing environment variables: {', '.join(missing)}")
return 2
session = ld.session.platform.Definition(
app_key=os.environ["LSEG_APP_KEY"],
grant=ld.session.platform.GrantPassword(
username=os.environ["LSEG_USERNAME"],
password=os.environ["LSEG_PASSWORD"],
),
signon_control=True,
).get_session()
try:
session.open()
ld.session.set_default(session)
headlines = ld.news.get_headlines(
"LSEG.L",
start="20.08.2024",
end=timedelta(days=-4),
count=10,
)
print(headlines.to_string())
return 0
finally:
ld.close_session()
if __name__ == "__main__":
raise SystemExit(main())
client is getting this error:
Insufficient scope for key=/data/news/v1/headlines, method=GET.
Required scopes: {'trapi.data.news.read'}
Missing scopes: {'trapi.data.news.read’}
Could you please let us know the main reason and help me fixing the code to get info?
Thanks
JSB