---
title: "TigerGraphConnection"
component: "pytigergraph"
version: "1.7"
module: "core-functions"
html_url: "/pytigergraph/1.7/core-functions/base"
canonical_url: "https://www.tigergraph.com/docs/pytigergraph/1.7/core-functions/base"
markdown_url: "https://www.tigergraph.com/docs/pytigergraph/1.7/core-functions/base.md"
---

[View as HTML](https://www.tigergraph.com/docs/pytigergraph/1.7/core-functions/base)

# TigerGraphConnection

A TigerGraphConnection object provides the HTTP(S) communication used by all other modules.

## _\_init\__()

`_init_(host: str = "http://127.0.0.1", graphname: str = "MyGraph", gsqlSecret: str = "", username: str = "tigergraph", password: str = "tigergraph", tgCloud: bool = False, restppPort: Union[int, str] = "9000", gsPort: Union[int, str] = "14240", gsqlVersion: str = "", version: str = "", apiToken: str = "", useCert: bool = None, certPath: str = None, debug: bool = None, sslPort: Union[int, str] = "443", gcp: bool = False, jwtToken: str = "")`

Initiate a connection object.

#### Parameters:

* `host`: The host name or IP address of the TigerGraph server. Make sure to include the protocol (http:// or https://). If `certPath` is `None` and the protocol is https, a self-signed certificate will be used.
* `graphname`: The default graph for running queries.
* `gsqlSecret`: The secret key for GSQL.  
See <https://www.tigergraph.com/docs/tigergraph-server/current/user-access/managing-credentials#%5Fsecrets>.\[this\] for more details.
* `username`: The username on the TigerGraph server.
* `password`: The password for that user.
* `tgCloud`: Set to `True` if using TigerGraph Cloud. If your hostname contains `tgcloud`, then this is automatically set to `True`, and you do not need to set this argument.
* `restppPort`: The port for REST++ queries.
* `gsPort`: The port for gsql server.
* `gsqlVersion`: The version of the GSQL client to be used. Effectively the version of the database being connected to.
* `apiToken (Optional)`: Paremeter for specifying a RESTPP service token. Use `getToken()` to get a token.
* `version`: DEPRECATED; use `gsqlVersion`.
* `useCert`: DEPRECATED; the need for a CA certificate is now determined by URL scheme.
* `certPath`: The filesystem path to the CA certificate. Required in case of https connections.
* `debug`: DEPRECATED; configure standard logging in your app.
* `sslPort`: Port for fetching SSL certificate in case of firewall.
* `gcp`: DEPRECATED. Previously used for connecting to databases provisioned on GCP in TigerGraph Cloud.
* `jwtToken`: The JWT token generated from customer side for authentication

#### Raises:

TigerGraphException: In case on invalid URL scheme.

## customizeHeader()

`customizeHeader(timeout: int = 16000, responseSize: int = 32000000.0)`

Method to configure the request header.

#### Parameters:

* `tiemout (int, optional)`: The timeout value desired in milliseconds. Defaults to 16,000 ms (16 sec)
* `responseSize`: The size of the response in bytes. Defaults to 3.2E7 bytes (32 MB).

#### Returns:

Nothing. Sets `responseConfigHeader` class attribute.

## getVersion()

`getVersion(raw: bool = False) → Union[str, list]`

Retrieves the git versions of all components of the system.

#### Parameter:

* `raw`: Return unprocessed version info string, or extract version info for each component into a list.

#### Returns:

Either an unprocessed string containing the version info details, or a list with version info for each component.

#### Endpoint:

* `GET /version`See [Show component versions](https://www.tigergraph.com/docs/tigergraph-server/4.3/API/built-in-endpoints.md#_show_component_versions)

## getVer()

`getVer(component: str = "product", full: bool = False) → str`

Gets the version information of a specific component.

Get the full list of components using `getVersion()`.

#### Parameters:

* `component`: One of TigerGraph's components (e.g. product, gpe, gse).
* `full`: Return the full version string (with timestamp, etc.) or just X.Y.Z.

#### Returns:

Version info for specified component.

#### Raises:

`TigerGraphException` if invalid/non-existent component is specified.
