1. Authentication

The Oracle Graph server (PGX) uses an Oracle Database as identity manager. Both username and password based as well as Kerberos based authentication is supported.

You can connect to a remote graph server (PGX) instance in your Python program. You must first authenticate with the remote server before you can create a session as illustrated in the following example:

import pypgx as pgx
import pypgx.pg.rdbms.graph_server as graph_server

base_url = "https://localhost:7007"
username = "scott"
password = "tiger"

instance = graph_server.get_instance(base_url, username, password)
session = instance.create_session("python_pgx_client")
print(session)

if your token expires, you can log in again without losing any of your session data by reauthenticating as illustrated in the following example:

graph_server.reauthenticate(instance, "<user>", "<password>") # log in again

Refer to the section below, for the complete API reference on user authentication.

Allows to connect to a graph server

pypgx.pg.rdbms.generate_token(base_url, username, password)

Get a handle to a PGX instance.

Parameters
  • base_url – The base URL in the format host [ : port][ /path] of the PGX server REST end-point.

  • username – The username to use when connecting to a PGX instance

  • password – The password to use when connecting to a PGX instance

Returns

Token to connect to a PGX instance

pypgx.pg.rdbms.get_embedded_instance()

Get a handle to an embedded PGX instance.

Returns

ServerInstance

pypgx.pg.rdbms.get_instance(base_url, kerberos_ticket_path, refresh_time_before_token_expiry=1800)

Get a handle to a PGX instance.

Parameters
  • base_url – The base URL in the format host [ : port][ /path] of the PGX server REST end-point. If base_url is None, the default will be used which points to embedded PGX instance.

  • kerberos_ticket_path – Path pointing to the location of the kerberos ticket to use when connecting to a PGX instance

  • refresh_time_before_token_expiry – Number of seconds to refresh, before token expires.

Returns

ServerInstance

pypgx.pg.rdbms.reauthenticate(instance, username, password)

Get a handle to a PGX instance.

Parameters
  • instance – The PGX instance on which the session is going to reauthenticate.

  • username – The username to use to reauthenticate to a PGX instance

  • password – The password to use to reauthenticate to a PGX instance

Returns

ServerInstance