Refinitiv Data Library for Python

session.close

This method closes the session and disconnects your application from the data platform.

Module

refinitiv.data.session

Syntax

session.close()

Parameters

None.

Returned value

None.

Usage

The following example demonstrates how to close a session and check the status of the session to ensure that it has been closed successfully.

import refinitiv.data as rd

DESKTOP_APP_KEY = os.getenv("DESKTOP_APP_KEY")
session = rd.session.desktop.Definition(app_key=DESKTOP_APP_KEY).get_session()
rd.session.set_default(session)
session.open()

# session is opened, so you can close it.
session.close()

# you can check session state
session.open_state  # returns OpenState.Closed

None.