You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update README to promote server_url over instance
Replace all code examples and documentation to use server_url as the
primary configuration parameter. The instance parameter is preserved
for backwards compatibility but deprioritized in documentation.
@@ -744,14 +744,34 @@ By default, an API error will raise a errors.GleanError exception, which has the
744
744
<!-- Start Server Selection [server] -->
745
745
## Server Selection
746
746
747
-
### Server Variables
747
+
### Server URL
748
748
749
-
The default server `https://{instance}-be.glean.com` contains variables and is set to `https://instance-name-be.glean.com` by default. To override default values, the following parameters are available when initializing the SDK client instance:
749
+
The recommended way to configure the Glean API server is to pass `server_url` when initializing the SDK client:
750
+
751
+
```python
752
+
from glean.api_client import Glean
753
+
754
+
glean = Glean(
755
+
api_token="your-api-token",
756
+
server_url="mycompany-be.glean.com",
757
+
)
758
+
```
759
+
760
+
The SDK accepts schemeless URLs (e.g., `"mycompany-be.glean.com"`); the `https://` prefix is added automatically.
761
+
762
+
You can also configure the server URL via the `GLEAN_SERVER_URL` environment variable.
763
+
764
+
### Server Variables (backwards compatible)
765
+
766
+
For backwards compatibility, the SDK also supports the `instance` parameter, which constructs the server URL using the pattern `https://{instance}-be.glean.com`:
|`instance`|`instance: str`|`"instance-name"`| The instance name (typically the email domain without the TLD) that determines the deployment backend. |
754
771
772
+
> [!NOTE]
773
+
> The `server_url` parameter is preferred over `instance`. If both are provided, `server_url` takes precedence.
774
+
755
775
#### Example
756
776
757
777
```python
@@ -761,8 +781,7 @@ import os
761
781
762
782
763
783
with Glean(
764
-
server_idx=0,
765
-
instance="instance-name",
784
+
server_url="mycompany-be.glean.com",
766
785
api_token=os.getenv("GLEAN_API_TOKEN", ""),
767
786
) as glean:
768
787
@@ -989,7 +1008,7 @@ from glean.api_client import Glean
989
1008
990
1009
glean = Glean(
991
1010
api_token=os.environ.get("GLEAN_API_TOKEN", ""),
992
-
instance=os.environ.get("GLEAN_INSTANCE", ""),
1011
+
server_url="mycompany-be.glean.com",
993
1012
)
994
1013
```
995
1014
@@ -1002,7 +1021,7 @@ from glean.api_client import Glean
0 commit comments