Initializing help system before first use

xpressinsight.AppInterface.get_rest_client

Purpose
Creates an object for communicating with the Insight server through the REST API.
Synopsis
xpressinsight.AppInterface.get_rest_client(self, *, client_id: Optional[str] = None, secret: Optional[str] = None, max_retries: int = 5) -> scenario.InsightRestClient
Arguments
client_id 
The client ID value to use to authenticate the session with the Insight server. If not specified on-premise, will be read from the system keyring entry "ficoxpress:<insight_url>".
secret 
The secret value to use to authenticate the session with the Insight server. If not specified on-premise, will be read from the system keyring entry "ficoxpress:<insight_url>". If client_id was specified, keyring will specifically look for an entry with that name and client_id.
max_retries 
The maximum number of times to attempt to retry a failed request, before giving up.
Return value

This function may raise the following errors:

  ValueError:

If sufficient credentials to authenticate are not passed to this function.

  scenario.InsightAuthenticationError

If we are unable to authenticate using the supplied credentials.

  scenario.InsightServerError

If there is an issue communicating with the Insight server.

Example
Example of obtaining an InsightRestClient on-premise, passing the credentials as plain text:
>>> MY_CLIENT_ID: str = '<copy client id from Insight UI to here>'
... MY_SECRET: str = '<copy secret from Insight UI to here>'
... client = self.insight.get_rest_client(
...     client_id=MY_CLIENT_ID, secret=MY_SECRET)			
Example of obtaining an InsightRestClient in DMP:
>>> client = self.insight.get_rest_client()			
Further information
1. The method get_rest_client is part of the class xpressinsight.AppInterface.
2. The REST interface can be used to make queries directly to the Insight server. This allows a wider range of operations than is usually permitted within an Insight scenario - creating other scenarios, executing them, editing their data, etc. However, it's important to note that any such requests are performed separately from the scenario, and do not inherit any information or privileges from it. In DMP, the returned client will make requests as a user named solutionclient - you will need to add this user to any apps you want to access. On premise, requests are made as the user for which the supplied client_id and secret values were generated.
3. If executing on-premise and client_id or secret are not specified, the Python "keyring" package will be used to read them from an entry named "ficoxpress:<insight_url>". (See the documentation of xpressinsight.scenario.InsightRestClient for full details.) However, it is not recommended that Insight apps make use of this, due to the difficulty of inserting keys into the separate keyrings of the users executing models within the Insight workers.
4. The returned InsightRestClient can be used as a context manager to ensure rapid cleanup of any resources (HTTP sessions, etc.).
5. When test mode has been activated, this function will return an object previously specified by the insight.set_rest_client method. If this has not been called, it will attempt to construct a client instance using the Insight URL previously passed to insight.set_insight-context. If this is also not available, a RuntimeError will be raised.
Related topics

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.