A minimal wrapper of the requests library for Glean's API.
pip install glean-requests
For more information on the REST API, see the Glean documentation.
from glean_requests import GleanRestClient
# Initialize the client
client = GleanRestClient(
api_token="your_api_token",
subdomain="your_subdomain",
)
# Example Search
# https://developers.glean.com/client/operation/search/
payload = { "query": "your_query" }
response = client.post("search", json=payload)
For more information on the Indexing API, see the Glean documentation.
from glean_requests import GleanIndexingClient
# Initialize the client
client = GleanIndexingClient(
api_token="your_api_token",
subdomain="your_subdomain",
)
# Example Get Datasource Configuration
# https://developers.glean.com/indexing/tag/Datasources/paths/~1getdatasourceconfig/post/
payload = {"datasource": "testing"}
response = client.post("getdatasourceconfig", json=payload)
For more information on Authentication, see the Glean documentation.
client = GleanRestClient(
api_token="your_api_token",
subdomain="your_subdomain",
act_as="optional_user_to_act_as", # For Global Tokens
auth_type="OAUTH" # Optional
)
- Simple interface for making authenticated requests to Glean's API endpoints
- Support for both REST and Indexing APIs
- Automatic handling of authentication headers and urls
- Support for global tokens
MIT